Error on Supabase Module
Uncaught SyntaxError: The requested module '/_nuxt/node_modules/@supabase/ssr/node_modules/cookie/index.js?v=ca354228' does not provide an export named 'parse' (at helpers.ts:2:10)
Goodday, I am getting this error upon installing the supabase module which is preventing my app from loading
My Config
supabase: {
url: process.env.NUXT_PUBLIC_SUPABASE_URL,
key: process.env.NUXT_PUBLIC_SUPABASE_KEY,
serviceKey: process.env.NUXT_SUPABASE_SERVICE_KEY,
redirectOptions: {
login: '/?auth=true',
callback: '/confirm',
include: ['/dashboard'],
exclude: [],
saveRedirectToCookie: true,
},
cookiePrefix: 'bit-auth-cookie',
types: '~utils/types/database.d.ts',
}
5 Replies
Hi @Favour Emeka. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
This error is related to an ESM compatibility issue with the Supabase module in your Nuxt application. The error occurs because the cookie module doesn't properly export the
parse
function in the ESM context.
Based on the knowledge sources, there are a couple of solutions you can try:
Solution 1: Install specific versions of dependencies
As mentioned in a similar issue, you can try installing specific versions of the cookie
and @supabase/ssr
packages:
Or if you encounter version not found errors, you can install without specifying versions and then update your package.json:
Then update your package.json to:
Github Issue #27544
Solution 2: Create a callback page
For the Supabase OAuth to work properly, you need to create a confirm.vue
page as specified in your redirectOptions. This is necessary for the authentication flow to complete correctly.
Stack Overflow Post
Additional Context
The error you're seeing is a common issue with ES Modules in Node.js, where modules with .js
extensions are expected to follow certain conventions. When a module doesn't properly export its functions in an ESM context, you'll see errors like the one you're experiencing.
Your Supabase configuration looks correct, with the proper redirectOptions set up. The issue is likely with the dependency versions rather than your configuration.
Let me know if these solutions work for you!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1241270899274022955> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Solved
[07:39:49.033] Running "vercel build"
[07:39:49.396] Vercel CLI 41.4.1
[07:39:50.048] Installing dependencies...
[07:39:52.966] npm error code ETARGET
[07:39:52.967] npm error notarget No matching version found for @supabase/ssr@^0.1.4.
[07:39:52.967] npm error notarget In most cases you or one of your dependencies are requesting
[07:39:52.967] npm error notarget a package version that doesn't exist.
[07:39:52.969] npm error A complete log of this run can be found in: /vercel/.npm/_logs/2025-04-06T06_39_50_347Z-debug-0.log
[07:39:53.004] Error: Command "npm install" exited with 1
[07:39:53.365]
Not working on production
@kapa.ai
[07:39:49.033] Running "vercel build"
[07:39:49.396] Vercel CLI 41.4.1
[07:39:50.048] Installing dependencies...
[07:39:52.966] npm error code ETARGET
[07:39:52.967] npm error notarget No matching version found for @supabase/ssr@^0.1.4.
[07:39:52.967] npm error notarget In most cases you or one of your dependencies are requesting
[07:39:52.967] npm error notarget a package version that doesn't exist.
[07:39:52.969] npm error A complete log of this run can be found in: /vercel/.npm/_logs/2025-04-06T06_39_50_347Z-debug-0.log
[07:39:53.004] Error: Command "npm install" exited with 1
[07:39:53.365]
Not working on productionLet me check the knowledge base for you again. One moment! :books:
----------------------
I can see you're having an issue deploying your Nuxt application to Vercel, specifically with the Supabase module. The error indicates that Vercel can't find version
^0.1.4
of the @supabase/ssr
package during the build process.
Solution for Vercel Deployment
Based on the error message, it seems the specific version of @supabase/ssr
you're trying to install doesn't exist or isn't available. Here are some steps to resolve this:
1. Update your package.json to use a version of @supabase/ssr
that exists in the npm registry. Since 0.1.4
isn't available, try using the latest version without specifying a fixed version:
2. Set the correct Nitro preset for Vercel in your nuxt.config.ts
:
3. Ensure Node.js version compatibility: Make sure you're using a compatible Node.js version. In your Vercel project settings, set Node.js to version 18 or higher.
Nuxt Deployment Documentation
Alternative Approach
If you're still facing issues, you can try using environment variables to explicitly set the Nitro preset:
This approach is mentioned in the Edge-Side Rendering documentation and can be helpful for Vercel deployments.
Edge-Side Rendering Documentation
Additional Troubleshooting
If the issue persists, you might need to:
1. Remove package-lock.json
and node_modules
folder
2. Run npm install
again locally to generate a fresh lock file
3. Commit these changes and redeploy
This approach has helped resolve similar dependency issues in Nuxt applications deployed to cloud platforms.
Let me know if you need further assistance with your Vercel deployment!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1241270899274022955> Kapa.ai is still learning and improving, please let me know how I did by reacting below.