You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
unzip this repo (which I scaffolded from npm create cloudflare@latest -- my-next-app --framework=next per cloudflare's guide, and then followed clerk's nextjs instructions)
add the needed secret key, which I obfuscated.
run npm run preview which builds the nextjs app and then does some cloudflare magic to make the middleware functions run on cloudflare workers [if I understand correctly...]
open the localhost link.
Expected behavior:
Clerk will find the env vars I set in .env, and the login widget etc will work.
Actual behavior:
I get a 500 error because the secret key is not found. Clerk only looks within process.env for the needed env vars. But I am deploying to cloudflare workers, in which process.env is empty. To get this to work correctly, I instead of putting the env vars in .env, I need to put them in .dev.vars, which is cloudflare's version of this.
I think the solution is the same as in the linked issue above, where clerk looks through context.cloudflare.env instead. To really make this robust, if possible, really I think this logic for fetching env vars should get hoisted to some common util package where all the different framework connectors can use it, and so it will be solved for all of them.
I am also experiencing this with the nuxt module running on cloudflare pages, in praticular since migrating form vue-clerk to the new official @clerk/nuxt module.
@scottrblock we fixed reading of CF env vars in @clerk/tanstack-starthere. The example you mentioned is using an outdated version of @clerk/tanstack-start
Preliminary Checks
I have reviewed the documentation: https://clerk.com/docs
I have searched for existing issues: https://github.com/clerk/javascript/issues
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
zipped repo attached below
Publishable key
pk_test_Zm9uZC1tYW50aXMtNTIuY2xlcmsuYWNjb3VudHMuZGV2JA
Description
I think this is basically a nextjs version of this issue fro the remix connector.
Steps to reproduce:
npm create cloudflare@latest -- my-next-app --framework=next
per cloudflare's guide, and then followed clerk's nextjs instructions)npm run preview
which builds the nextjs app and then does some cloudflare magic to make the middleware functions run on cloudflare workers [if I understand correctly...]Expected behavior:
Clerk will find the env vars I set in
.env
, and the login widget etc will work.Actual behavior:
I get a 500 error because the secret key is not found. Clerk only looks within process.env for the needed env vars. But I am deploying to cloudflare workers, in which process.env is empty. To get this to work correctly, I instead of putting the env vars in
.env
, I need to put them in.dev.vars
, which is cloudflare's version of this.I think the solution is the same as in the linked issue above, where clerk looks through
context.cloudflare.env
instead. To really make this robust, if possible, really I think this logic for fetching env vars should get hoisted to some common util package where all the different framework connectors can use it, and so it will be solved for all of them.Environment
The text was updated successfully, but these errors were encountered: