简体   繁体   中英

Google Cloud Platform gives PEM Error when using third party libraries

Let me start off by saying that of course this works on my local dev environment.

I am fairly new to Google Cloud Platform, as I just created/uploaded my first project. I have a node app running NestJs. I use SendGrid for sending mails and Google Cloud Storage to store my files.

The add GCS I created a service account and downloaded the JSON file containing my keys. I added these keys to my .env file as well as a build trigger on GAE.

Now as I mention, everything is working perfectly local, which tells me that the keys are working fine. But when uploading to app to GAE, files are not being uploaded to GCS, and my email are not even sending via SendGrid. It is as if all third party Libraries stop working. When looking at the logs, I see the following errors:

Error: error:0909006C:PEM routines:get_name:no start line at Sign.sign (internal/crypto/sig.js:110:29)

AND

Error: error:0908F066:PEM routines:get_header_and_data:bad end line at Sign.sign (internal/crypto/sig.js:110:29)

Which seems like there is an invalid private key. But I am using the Private key that I got from Google itself, so this is where I am stuck.

I do not know if I am missing a step or if I am doing everything completely wrong? Do I need to register third party software somewhere? My code works well. The API calls are doing their job and the data is being saved to the DB. I just do not know why emails are not being send and documents are not being uploaded. As I mentioned, I am still new to Google Cloud Platform and do not know it quite too well.

Is there anyone that can point me in the right direction or just where to start looking? Has anyone encountered a similar or same issue before?

I know google is a bit weird with their errors so I am not even sure if I need to look at the Private key.

I have a very similar problem. GCS is working locally but does not work when I host my site on Heroku.

What is even more interesting is that I am using another web site to upload the data to GCS and for that web site things work both locally as well as on Heroku!!

I have been struggling with this by googling the issue but zilch!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM