Closed Penkie closed 3 years ago
I think this may have been fixed by https://github.com/supabase/gotrue-js/pull/37 What version of gotrue-js
is it pulling in?
:tada: This issue has been resolved in version 1.1.4 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I updated supabase-js to 1.1.4 and checked that gotrue-js is 1.9.3 (wich is the case) and I'm still having this issue
OK thanks for the update @Penkie . Reopening to investigate ..
- Create Angular project
- Create angular service
Could you please set this up on codesandbox or give some instructions? I've never used angular, this would probably take me an hour to figure out. Even better if you can start ad branch with anangular-todo-list
in our examples. That would be massively helpful for the community (but not necessary, I just need a way to debug this)
I tried with stackblitz, no problem I didn't have any errors. Tried also on codesandbox, loads of problems, maybe the dependencies not working. Anyway I created a repo with the Angular project inside : https://github.com/Penkie/supabase-js-debug-angular
You can check there
Note that I did not create any service (like I mentionned up there that you have to, but actually no you don't), so everything is on app.component.ts
For what it's worth, I'm having the same issue in a svelte/sapper app. For now, I'm bypassing the error with window.process = window.process || null
in the page's script. It's not exactly ideal, but for now I can move on :)
I've setup a basic repro repo at https://github.com/laurentS/supabase-bug-repro-113 to reproduce:
All it takes is importing the supabase client (see the last commit in the main branch). Hope this helps!
Looks like gotrue-js is using process.env
, which makes it non-isomorphic. https://github.com/supabase/gotrue-js/pull/37 moves the problem to the bundler (Rollup) instead, which wasn't able to match-replace process.env
. So if you add "process": undefined
in the Rollup replace plugin in laurentS's example above, the app works.
Can we maybe refactor gotrue-js to use e.g. default parameters when initializing the client instead?
Error report from @thorwebdev our unpkg build (https://unpkg.com/@supabase/supabase-js@1.1.4/dist/umd/supabase.js) is erroring
Hey @soedirgo - just checking on this commit
particularly these lines:
new webpack.DefinePlugin({
'process.env.GOTRUE_URL': undefined,
'process.env.AUDIENCE': undefined,
'process.env.EXPIRY_MARGIN': undefined,
'process.env.STORAGE_KEY': undefined,
}),
Is there a webpack plugin that can fix this issue for browser builds? Maybe this?
Huh, I don't remember adding those... let me try that.
Hey @Penkie, can you update the supabase-js client and see if it works now? I tried @laurentS's Sapper app with the update and saw no issue.
Edit: my bad, it's still not working. Give me a moment.
So using the Webpack plugin above wouldn't fix it, because it only affects the browser build that's in dist/umd
. So the change needs to be in the user's bundler config.
@kiwicopple is there a specific reason to use process.env
in gotrue-js? Looks like it's only used as default options for the client. Otherwise I can make a quick PR to fix this.
is there a specific reason to use process.env in gotrue-js
That was just as a convenience, but looks like it's problematic. How are these usually handled in isomorphic libs? Using dotenv?
I don't think libraries in general use process.env
, only apps. Maybe it's possible to use Webpack for all 3 builds, but that's an antipattern (bundling should be done by end-user apps, not libraries), and more trouble than it's worth, IMO.
For another data point, I was running into a similar issue, and applied the fix you put up in https://github.com/supabase/gotrue-js/pull/42 locally, and it resolved the issue.
OK , just pushing the new version - I'll keep it open this time until we've confirmed that it's resolved
:tada: This issue has been resolved in version 1.3.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Should be working now, when trying laurentS's example above make sure to yarn upgrade
first. Let us know if it works for y'all!
Updating to 1.3.2
did fix the problem for me.
thanks for the patience everyone! We're super busy, so a bit slow getting to some of these items. I'll close this, and feel free to reopen if you have any issues
And thanks for checking out Supabase ⚡
Bug report
Describe the bug
Using Angular, creating the client produce this error on the console:
Uncaught ReferenceError: process is not defined
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
const supabase = createClient('yoururl', 'yourkey')
Expected behavior
No errors should happen
System information