Open alvarp opened 8 months ago
const secret = process.env.COOKIE_SECRET || "default";
Cloudflare runtime does not have process.env
so you'll need to follow the Cloudflare way for environment variables: https://developers.cloudflare.com/workers/configuration/environment-variables/
Since it's a secret, you may want to put it in .dev.vars locally. And you'll also need to define it using the Pages dashboard when you deploy.
I put together the cloudflare example (https://github.com/mw10013/remix-auth-totp-cloudflare-example) for remix-auth-totp
. It may be helpful to see one way of approaching environment variables in remix with cloudflare though it drags in KV and D1 so may be a bit noisy.
@mw10013 Thank you for your reply. I'll check if updating the env-var reference fixes this.
Reproduction
Github Repo with isolated repro: https://github.com/alvarp/remix-vite-cloudflare-auth-repro
Running npm run deploy in this project will result in a broken deploy. The wrangler cli reports that the deploy is successful but the Cloudflare dashboard shows
This deployment failed
without any other info.Just commenting the usage of the auth helpers in the line 15 of the index route will result in a fully successful deploy, meaning that the issue comes from the
createCookie
method.Please let me know if I should expand something for an easier reproduction, happy to help!
System Info