Open MarianMichalovic opened 2 years ago
Running into this, too. Here's a repo to reproduce this: https://github.com/kevcodez/nuxt-on-the-edge
Fork and deploy that to Vercel and open the page.
ReferenceError: global is not defined
at worker.js:21:39244
at worker.js:14:173
at fn (worker.js:53:15532)
at Object.<anonymous> (worker.js:57:5)
at Object.<anonymous> (worker.js:59:6)
at De (worker.js:77:13740)
at worker.js:77:15871
Cloudflare workers require node_compat = true in wrangler.toml https://developers.cloudflare.com/workers/wrangler/configuration/#node-compatibility
With this setup it works.
I've encountered the same problem on cloudflare after migrating from yarn to pnpm (deployment failed ... even with 0 code). Turns out, it's caused by the way pnpm is isolating packages - which is why it's working fine on yarn, but not with pnpm.
adding public-hoist-pattern[]=@supabase/supabase-js*
to .npmrc
does seem to fix this for me on cloudflare workers - at least with "@nuxtjs/supabase": "^1.2.0"
(no other workarounds applied).
if i'll still encounter problems down the road, i'm not sure - but for me, i got the "global is not defined" error already on deployment, at the "Deploying to Cloudflare's global network" step.
Version
@nuxtjs/supabase: 0.3.0 nuxt: 3.0.0
Cloudflare Workers:
Vercel Edge
In project only @nuxtjs/supabase package. Without @nuxtjs/supabase with supabase-js works correct.