Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supabase/ssr export error in browser #725

Closed
2 tasks done
Aietes opened this issue Jan 24, 2024 · 1 comment
Closed
2 tasks done

supabase/ssr export error in browser #725

Aietes opened this issue Jan 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Aietes
Copy link

Aietes commented Jan 24, 2024

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When using supabase/ssr in Nuxt, provided via a Nuxt module, I get the following error in the browser:

Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/cookie@0.5.0/node_modules/cookie/index.js?v=d88ad7de' does not provide an export named 'parse'

It comes from packages/ssr/src/utils/helpers.ts, where cookie helper functions are imported:

export { parse, serialize } from 'cookie';

Is there anything I can do about it? The issue seems to be that I'm using ssr in a ESM module, and the helper functions are CommonJS. There seem to be a pull request in the cookie library, but it's not merged yet, and ssr would still need to update the dependency.

Expected behavior

No module export error in the browser.

System information

  • OS: macOS
  • Browser: chrome, safari
  • Version of supabase-js: 2.39.3 (ssr 0.0.10)
  • Version of Node.js: v21.6.1

Additional context

Add any other context about the problem here.

@Aietes Aietes added the bug Something isn't working label Jan 24, 2024
@Aietes
Copy link
Author

Aietes commented Jan 30, 2024

I worked around the issue by pre-bundling the package using optimizeDeps in Vite. This fixes the error, I believe Vite fixes the imports/exports during the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant