N
Nuxt8mo ago
xmatthias

@nuxtjs/supabase deploy problem on cloudflare

I've got a problem with a nuxt project, which doesn't seem to deploy on cloudflare the moment @nuxt/supabase is added to the project. The deployment always ends with the following lines:
20:19:18.601 ✨ Compiled Worker successfully
20:19:18.655 Found _routes.json in output directory. Uploading.
20:19:18.668 Validating asset output directory
20:19:27.353 Success: Assets published!
20:19:28.628 Error: Failed to publish your Function. Got error: Uncaught ReferenceError: global is not defined
at chunks/runtime.mjs:1:30918
20:19:18.601 ✨ Compiled Worker successfully
20:19:18.655 Found _routes.json in output directory. Uploading.
20:19:18.668 Validating asset output directory
20:19:27.353 Success: Assets published!
20:19:28.628 Error: Failed to publish your Function. Got error: Uncaught ReferenceError: global is not defined
at chunks/runtime.mjs:1:30918
Interestingly, this is only happening when using pnpm. the same exact project/setup with yarn does seem to work just fine. All dependencies and pnpm are uptodate - and all issues i found about this are from mid-2023 - which i'd hope would've removed this in the meantime. --- An very minimal example project is here: https://github.com/xmatthias/nuxt_supabase_deploy_test as the commit history shows - i did experiment quite a bit with it ...
1 Reply
xmatthias
xmatthiasOP8mo ago
Rather interesting side-note: I've now found out that by using PNPM's shamefully-hoist=true setting, this can be fixed. that's however a workaround, which (in my understanding) suggests that the package is not listing a dependency it would need (i do lack understanding of the nuxt underlyings to find out which one though) hm - a more precise "hoist" is .npmrc -> public-hoist-pattern[]=@supabase/supabase-js* ... not sure what exactly causes this ... but i'm sure it's some shadow dependency that's not listed but imported "somehow"
Want results from more Discord servers?
Add your server