Error on calculating daily tasks
Hello, I am getting this error after running wasp start:
[ Server!] Error calculating daily stats: Error: 2 UNKNOWN: Getting metadata from plugin failed with error: error:1E08010C:DECODER routines::unsupported
[ Server!] at callErrorFromStatus (/root/app/node_modules/@grpc/grpc-js/src/call.ts:82:17)
[ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client.ts:360:55) [ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34) [ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48) [ Server!] at <anonymous> (/root/app/node_modules/@grpc/grpc-js/src/resolving-call.ts:163:24)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:77:11) [ Server!] for call at [ Server!] at ServiceClientImpl.makeUnaryRequest (/root/app/node_modules/@grpc/grpc-js/src/client.ts:325:42) [ Server!] at ServiceClientImpl.<anonymous> (/root/app/node_modules/@grpc/grpc-js/src/make-client.ts:189:15) [ Server!] at /root/app/node_modules/@google-analytics/data/build/src/v1beta/beta_analytics_data_client.js:190:29 [ Server!] at /root/app/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16 [ Server!] at OngoingCallPromise.call (/root/app/node_modules/google-gax/build/src/call.js:67:27) [ Server!] at NormalApiCaller.call (/root/app/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19) [ Server!] at /root/app/node_modules/google-gax/build/src/createApiCall.js:112:30 I put the base64 encoded key inside .env.server for the GOOGLE_ANALYTICS_PRIVATE_KEY Inside googleAnalyticsUtils.ts I have printed the private key: const PRIVATE_KEY = Buffer.from(process.env.GOOGLE_ANALYTICS_PRIVATE_KEY!, 'base64').toString('utf-8'); console.log(PRIVATE_KEY); And it is the same as the one in the service JSON from google cloud
[ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client.ts:360:55) [ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34) [ Server!] at Object.onReceiveStatus (/root/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48) [ Server!] at <anonymous> (/root/app/node_modules/@grpc/grpc-js/src/resolving-call.ts:163:24)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:77:11) [ Server!] for call at [ Server!] at ServiceClientImpl.makeUnaryRequest (/root/app/node_modules/@grpc/grpc-js/src/client.ts:325:42) [ Server!] at ServiceClientImpl.<anonymous> (/root/app/node_modules/@grpc/grpc-js/src/make-client.ts:189:15) [ Server!] at /root/app/node_modules/@google-analytics/data/build/src/v1beta/beta_analytics_data_client.js:190:29 [ Server!] at /root/app/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16 [ Server!] at OngoingCallPromise.call (/root/app/node_modules/google-gax/build/src/call.js:67:27) [ Server!] at NormalApiCaller.call (/root/app/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19) [ Server!] at /root/app/node_modules/google-gax/build/src/createApiCall.js:112:30 I put the base64 encoded key inside .env.server for the GOOGLE_ANALYTICS_PRIVATE_KEY Inside googleAnalyticsUtils.ts I have printed the private key: const PRIVATE_KEY = Buffer.from(process.env.GOOGLE_ANALYTICS_PRIVATE_KEY!, 'base64').toString('utf-8'); console.log(PRIVATE_KEY); And it is the same as the one in the service JSON from google cloud
3 Replies
Hi @mihaipaulx. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error message and details you've provided, it seems you're encountering an issue with Google Analytics integration in your Wasp application. The error suggests there's a problem with the SSL/TLS connection when trying to authenticate with Google's servers. Let's go through some potential solutions:
1. Environment Variables:
Make sure your environment variables are set correctly. In Wasp, server-side environment variables should be placed in the
.env.server
file at the root of your project.
Wasp Docs: Environment Variables (https://wasp-lang.dev/docs/project/env-vars) states:
2. Google Analytics Setup:
Ensure that you've correctly set up your Google Analytics project and have the right credentials. The Wasp Docs: Setting up Google Auth (https://wasp-lang.dev/docs/auth/social-auth/google#3-creating-a-google-oauth-app) provides a step-by-step guide for setting up Google OAuth, which might be helpful for Google Analytics setup as well.
3. Private Key Format:
The error message suggests there might be an issue with decoding the private key. Make sure the private key is correctly base64 encoded before adding it to your .env.server
file. Also, ensure there are no extra spaces or newline characters in the encoded string.
4. Node.js Version:
This error can sometimes occur due to incompatibilities with older Node.js versions. Make sure you're using a recent, stable version of Node.js that's compatible with Wasp.
5. SSL/TLS Issues:
The error message mentions "DECODER routines::unsupported", which could indicate an SSL/TLS problem. This might be related to your local environment or how the private key is being processed.
If you've verified all these points and are still encountering the issue, you might want to try the following:
1. Double-check that all required environment variables for Google Analytics are set correctly.
2. Ensure your Google Cloud project has the necessary APIs enabled.
3. Try regenerating your service account key and use the new credentials.
If the problem persists, you may need to provide more details about your setup or reach out to the Wasp community for more specific assistance. The Wasp Discord channel (https://discord.com/channels/686873244791210014/1215945587841831033) could be a good place to get more interactive support.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @mihaipaulx, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I correctly set up the environment variables from google analytics, namely the
GOOGLE_ANALYTICS_CLIENT_EMAIL
GOOGLE_ANALYTICS_PRIVATE_KEY
GOOGLE_ANALYTICS_PROPERTY_ID
from the service account I took the private_key and I encoded it with
echo -n "-----BEGIN PRIVATE KEY-----\nMI...A++eK\n-----END PRIVATE KEY-----\n" | base64
encoded it with https://stackblitz.com/edit/stackblitz-starters-fvhlsc?file=index.js&view=editor as well and I get the same encoded string
I am using nodejs v20.18.1 and ran npm upgrade in case @grpc/grpc-js is outdated, but still with no success
I somehow had my private key changed as I messed around with the "\n"s and it became different than what I initially received from google, now I got the key from there again and finally it s working :boi:
The link above was the solution, just make sure to put the correct string in