wobsoriano / nuxt-clerk-template

Auth starts here with the Nuxt and Clerk Demo
https://nuxt-clerk-template.nuxt.dev
97 stars 11 forks source link

[500] Missing Clerk Secret Key or API Key on Production #7

Closed roder125 closed 1 year ago

roder125 commented 1 year ago

When I test this repo local everything works fine with my Clerk public and private key stored in the .env file. As soon as I build the application with npm run build and execute node .output/server/index.mjs I get an Error that the keys is missing. I put an .env File into the .output/server directory and I even hardcoded the keys in the nuxt.config, but I still get the Error shown below.

[nuxt] [request error] [unhandled] [500] Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance. at assertValidSecretKey (C:\Dev\Antaris\nuxt-clerk-template.output\server\node_modules\@clerk\backend\dist\index.js:753:11) at authenticateRequest (C:\Dev\Antaris\nuxt-clerk-template.output\server\node_modules\@clerk\backend\dist\index.js:2785:3) at Proxy.authenticateRequest2 (C:\Dev\Antaris\nuxt-clerk-template.output\server\node_modules\@clerk\backend\dist\index.js:2892:12) at authenticateRequest (/C:/Dev/Antaris/nuxt-clerk-template/.output/server/node_modules/@clerk/clerk-sdk-node/dist/esm/chunk-MU7G7AH2.mjs:95:23) at /C:/Dev/Antaris/nuxt-clerk-template/.output/server/node_modules/@clerk/clerk-sdk-node/dist/esm/chunk-MU7G7AH2.mjs:179:34

Any Ideas what I am missing? I am happy for every help :)

wobsoriano commented 1 year ago

This is the intended behavior. More info here.

After your server is built, you are responsible for setting environment variables when you run the server.

For Linux or Mac, you can run:

CLERK_PUBLISHABLE_KEY=YOUR_KEY CLERK_SECRET_KEY=YOUR_KEY node .output/server/index.mjs
roder125 commented 1 year ago

Thank you really much, this fixed it for me!