supabase
supabase copied to clipboard
Can't deploy to Vercel Edge Functions to work if supabase module is present
Version
"@nuxtjs/supabase": "^0.3.1", "nuxt": "^3.2.2"
Steps to reproduce
- Start a new Nuxt 3 project.
- Install supabase module and add it to nuxt.config.ts modules array.
- In nuxt.config.ts, set nitro preset:
nitro: { preset: "vercel-edge", },
- Setup .env variables in Vercel.
- Deploy to Vercel.
What is Expected?
When nitro preset is default node-js, everythings goes right. With Vercel-edge preset, the same should happen.
What is actually happening?
It builds but here is the result when you try to browse it:
And here is the log:
#120
Thanks man !
This is still an issue for me. I can make it work if I switch to Vercel serverless function but it breaks on their edge functions.
I think this is come from a proxy probleme with /api/_supabase/..., vercel use '/api' for edge function
"nuxt": "^3.4.1", "@nuxtjs/supabase": "^0.3.5"
Deployed a project to Vercel with the edge present i got the following error:
TypeError: Cannot read properties of undefined (reading 'bind')
at (index.mjs:1:493518)
at (__nitro:middleware.js:1:17)
If i remove the @nuxtjs/supabase module everything is working fine.
Sorry to add to the echoes, but I'm getting this same thing. Has anyone figured this out?
If anyone can take a crack at it, here's Vercel's default Nuxt starter for easier deploy: https://vercel.com/templates/nuxt/nuxtjs-boilerplate
So long as this module is included in the nuxt-config, deploy fails
Hello, I still have the problem. Is there a solution?
"nuxt": "^3.4.1", "@nuxtjs/supabase": "^0.3.5"
Deployed a project to Vercel with the edge present i got the following error:
TypeError: Cannot read properties of undefined (reading 'bind') at (index.mjs:1:493518) at (__nitro:middleware.js:1:17)
If i remove the @nuxtjs/supabase module everything is working fine.
I fixed this error by patching the dependency websocket
used by Supabase Realtime. (I used the patch-package lib)
diff --git a/node_modules/websocket/lib/WebSocketConnection.js b/node_modules/websocket/lib/WebSocketConnection.js
index 219de63..ed68a65 100644
--- a/node_modules/websocket/lib/WebSocketConnection.js
+++ b/node_modules/websocket/lib/WebSocketConnection.js
@@ -32,9 +32,13 @@ const STATE_ENDING = 'ending';
// Connection is fully closed. No further data can be sent or received.
const STATE_CLOSED = 'closed';
-var setImmediateImpl = ('setImmediate' in global) ?
- global.setImmediate.bind(global) :
- process.nextTick.bind(process);
+if ('setImmediate' in global) {
+ var setImmediateImpl = global.setImmediate.bind(global);
+} else if (typeof process !== 'undefined' && process.nextTick) {
+ var setImmediateImpl = process.nextTick.bind(process);
+} else {
+ var setImmediateImpl = function(fn) { setTimeout(fn, 0); };
+}
var idCounter = 0;
Not sure if this code works because I don't use Realtime in my project, but it fixed the issue for me.
Having the same issue. Thanks @felipemarcos your patch seems to help! (not using realtime myself either)