Open Fawwaz-2009 opened 2 weeks ago
bump. I'm seeing a similar issue when creating session storage in cloudflare-pages using the cloudflare package!
Satck trace:
ReferenceError: crypto is not defined
at createKey (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/cloudflare/dist/crypto.js:34:13)
at unsign (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/cloudflare/dist/crypto.js:27:19)
at decodeCookieValue (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/cookies.js:92:33)
at Object.parse (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/cookies.js:64:66)
at Object.getSession (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/sessions/cookieStorage.js:36:67)
at Module.handleNewSession (/Users/moishi/Documents/Repos/punchpocket/web/app/utils/auth.server.ts:231:46)
at action (/Users/moishi/Documents/Repos/punchpocket/web/app/routes/__auth+/auth.$businessUserId.tsx:82:10)
at async Object.callRouteAction (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/data.js:37:16)
at async /Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:4644:21
at async callLoaderOrAction (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:4709:16)
at async Promise.all (index 1)
at async callDataStrategyImpl (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:4584:17)
at async callDataStrategy (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:4073:19)
at async submit (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:3932:21)
at async queryImpl (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:3890:22)
at async Object.queryRoute (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/router/dist/router.cjs.js:3859:18)
at async handleDataRequest (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/server.js:201:20)
at async requestHandler (/Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/server-runtime/dist/server.js:118:18)
at async /Users/moishi/Documents/Repos/punchpocket/node_modules/@remix-run/dev/dist/vite/cloudflare-proxy-plugin.js:70:25
Reproduction
run in dev and just refresh the page, you should see the crypto dependency error in the logs.
https://github.com/Fawwaz-2009/remix-crypto-form-issue
System Info
Used Package Manager
npm
Expected Behavior
there shouldn't be errors in the logs with fresh project, just because of adding a form and refreshing the page.
Actual Behavior
adding a form, then refreshing the page, shows errors in the logs