The server responded with a status of 500 ()

  • Site name: too1.netlify.app

This App’s all functions work in Local
but api and FIREBASE_PRIVATE_KEY didn’t work in Netlify

  • Build problems ( I solvedi it but still didn’t work)

I cannot build with this env
'"-----BEFORE PRIVATE KEY-----\nA\nB\nC\nF\n-----END PRIVATE KEY-----\n"'
So I changed this line
"-----BEFORE PRIVATE KEY-----\nA\nB\nC\nF\n-----END PRIVATE KEY-----\n"
Then I builded successfully

Expected Function ( Original Website on Vercel )

nfa-example.vercel.app

ps: the package (next-firebase-auth) describe only issue with Vercel. I want my app with Netlify .

This is a double post, superseded by a later post here:

Error 500 is from the API and it has nothing to do with your environment variables.

Did you check your function console? I can see this error:

  FirebaseAppError: Service account object must contain a string "client_email" property.
    at FirebaseAppError.FirebaseError [as constructor] (/var/task/node_modules/firebase-admin/lib/utils/error.js:44:28)
    at FirebaseAppError.PrefixedFirebaseError [as constructor] (/var/task/node_modules/firebase-admin/lib/utils/error.js:90:28)
    at new FirebaseAppError (/var/task/node_modules/firebase-admin/lib/utils/error.js:125:28)
    at new ServiceAccount (/var/task/node_modules/firebase-admin/lib/app/credential-internal.js:137:19)
    at new ServiceAccountCredential (/var/task/node_modules/firebase-admin/lib/app/credential-internal.js:70:15)
    at Object.cert (/var/task/node_modules/firebase-admin/lib/app/credential-factory.js:103:54)
    at ee (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:20653)
    at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:21480
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) {
      errorInfo: {
        code: 'app/invalid-credential',
       message: 'Service account object must contain a string "client_email" property.'
      },
      codePrefix: 'app'
    }

Oh , I will search about about firebase admin . I thought it has error in my env key because I got error like this in my Local when I removed that FIREBASE_PRIVATE_KEY in env.local.
You are the only one can save me.

Thanks you so much
I missed to add CLIENT_EMAIL in env
You saved me Sir Thanks

Sir How do you find that error by using function console . I don’t know how to use function console . I want to see error like this .

I’ve shared the link there.

There’s a time dropdown in the top-right of that console, choose past 1 day or so.

Also, you can check the error from the dev tools > network tab > your api call > response