'Error on Heroku when trying to post data ( error:0909006C Pem routines..._

I am trying to make a small nodeJS server deployed on Heroku, saving data to Firestore database. The server is deployed and running correctly. I use Insomnia to test my requests and when I use it locally I can send a post request and save my data object to the database without issues. However, when I try to send a post request to Heroku, I get a 500 error with this message:

{ "code": 16, "details": "Failed to retrieve auth metadata with error: error:0909006C:PEM routines:get_name:no start line", "metadata": {}, "note": "Exception occurred in retry method that was not classified as transient" }

I have read that it is necessary to add real line breaks in the env variable but I guess I am doing it already. This is my initializeApp function:

admin.initializeApp({
    credential: admin.credential.cert({
        projectId: process.env.PROJECT_ID,
        privateKey: process.env.PRIVATE_KEY
        ? process.env.PRIVATE_KEY.replace(/\\n/gm, "\n")
        : undefined,
        clientEmail: process.env.CLIENT_EMAIL
      }),
    databaseURL: "XXXXX"
  });

Any idea how to fix this?



Solution 1:[1]

As i see in this question: How to make an http DELETE request with JSON body in Flutter? the "delete" verb does not send data with Flutter. You can see @Roi Snir's answer in the previous link, a way to send data with "delete" by using the .Request method of the http package.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arton Hoxha