-
-
Notifications
You must be signed in to change notification settings - Fork 288
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-js fails with @sveltejs/kit (warning, sveltejs/kit is experimental) #89
Comments
on a related note, building the project (as opposed to running the dev server) results in this error:
which seems to clearly be stating that it is attempting to bundle the built in nodejs module |
Updated: The issue from They treat
My workaround for @sveltejs/kit users:
My English is not good |
Hey @langbamit I just released a new version. Can you please reinstall supabase |
@kiwicopple, @langbamit thanks for your help. I just updated the deps to latest and added the suggested fix to my snowpack.config.js, I still see the same error. andrew sveltekit-supabase-bug npm ls --depth=0
sveltekit-supabase-bug@0.0.1 /home/andrew/Code/development/sveltekit-supabase-bug
├── @supabase/supabase-js@1.1.4
├── @sveltejs/adapter-node@1.0.0-next.0
├── @sveltejs/kit@1.0.0-next.17
├── @sveltejs/snowpack-config@1.0.0-next.0
└── svelte@3.31.2 I have updated the repro repo here https://github.com/andykais/supabase-svelte-kit-bug-repro |
I think we can close this issue now. |
This issue should be closed and new issue made if it still persists with the open beta version of sveltekit. Should be noted that Sveltekit dropped Snowpack and use Vite instead (https://github.com/vitejs/vite) |
hi, yes there is still an issue with the public beta version of sveltekit (or more probably, vite) this is the error that happens when i require supabase in an api route: 500
ENOENT: no such file or directory, open '/Users/swyx/Work/testbeds/trysveltething/fullstack-sveltekit/node_modules/@supabase/supabase-js/src/index.ts'
Error: ENOENT: no such file or directory, open '/Users/swyx/Work/testbeds/trysveltething/fullstack-sveltekit/node_modules/@supabase/supabase-js/src/index.ts' i have no idea where the /src/index.ts reference comes from, it doesnt show up in the module's package.json.... update: looks like it's getting it from the sourcemap sveltejs/kit#673 |
FWIW - installing as a dev dependency seems to resolve the issue in my SvelteKit project: |
Instead of your import, maybe:
|
@mankins - unfortunately this doesn't seem to work, neither with |
I found this note in the SvelteKit FAQ which may be relevant:
As suggested, I just tried to That leads me to wonder if somewhere in the dependency tree, we need to ask some package maintainer to provide ESM support? |
This bug report is old. It's from when SvelteKit was built on top of Snowpack. SvelteKit is now built on Vite and meriyah was removed as part of that transition: sveltejs/kit#409. I can't find meriyah in the SvelteKit dependencies anymore. Can you make sure you're using the latest version of SvelteKit? If so, and there's still an issue, can you share the new stack trace? |
Oh, nevermind. I see the comment above that there was a new error: #89 (comment). But then I'm really confused because the next message says it's been fixed: #89 (comment) I think we should probably file a new issue and close this one which has gotten quite muddled. I can't tell what issue exists if any |
Yeah it seems a similar issue is happening in Vite; it has to do with the bundler managing a mixture of CSJ and ESM modules as far as I can tell. Someone mentioned this is a growing pain for these next generation build tools which leveral native ESM imports. I'll try and draft a new issue on this topic today still; I'm collecting as much info as I can to elucidate it. |
If you're using SvelteKit's |
OK #153 is resolved now 👍 . Let me know if this one can also be closed |
Now that the sourcemap issue has been fixed we can see the real underlying error which is #155. I think this issue could be closed in favor of that one |
Bug report
adding
into any script tag in a svelte project will cause a 500.
Describe the bug
I believe this has to do with svelte kit renders being executed on both the server side and client side. It also appears to be related to the javascript parser they use (meriyah). Starting the project, and opening a page containing the supabase import results in the following error:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
repro repo: https://github.com/andykais/supabase-svelte-kit-bug-repro
npm install
npm run dev
http://localhost:3000
Expected behavior
supabase should ideally work in both the client and server environments of svelte kit.
Screenshots
N/A
System information
Additional context
Note: this is an error that is present in an experimental web framework. It is therefore likely a result of this project not being fully featured. Still, this feels like it is worth tracking.
I attempted dropping the supabase-js built files into the meriyah online compiler to see if the errors were visible there. However it appeared to compile the js code without any issue. There may be specific knobs that svelte kit has tweaked which cause the
Unexpected token
error, but I am unsure.The text was updated successfully, but these errors were encountered: