Open Tobbe opened 3 years ago
I wonder if we need something like https://github.com/facebook/codemod to match "what to replace and where" instead of using regex?
Is the root cause of this issue that we're matching the incorrect thing?
@peterp I don't think that's the the only thing.
After I got that error message I removed everything auth related from App.js
, and re-ran the command, again with --force
and then it started to complain about regex mismatches.
I tried reproducing this by setting up dbAuth then supabase. While the supabase setup command finished, it left me in a broken state. It didn't change the AuthProvider
's type and client:
// Still dbAuth and no client
<AuthProvider type="dbAuth">
We could achieve this kind of precision with jscodeshift. But this issue raises the larger question of: how easy is it / how easy should we make it to switch between setup commands? (Not just for auth but for deployment, ui too)
Accordingly, https://github.com/redwoodjs/redwood/issues/3683 is one solution to this.
I do not think we should support, via command line, swapping Auth providers. Instead, we can focus on documentation. (I believe someone recently documented swapping auth providers, but I couldn't find it across Forums or Discord.)
I encountered this issue today while replacing Netlify Identity.
I was able to solve it by removing the <AuthProvider>
component in App
's render function. After that was removed the setup auth
command completed successfully.
It didn't fully clean up the old netlify installation though, so I had to manually remove this line from App.tsx
:
isBrowser && netlifyIdentity.init()
and also remove the netlify-identity-widget
dependency from web's package.json
.
We're currently investigating a full rewrite of how we handle different auth service providers. I think it'll be much easier to replace one for another after that. Or even run two at the same time 😮
I tried to setup supabase auth
It correctly detected that I already had an auth client, and asked me to run the command again, with
--force
, so I did. But even with--force
it fails.The project is currently using goTrue auth
I'm not on the latest version of RW, so sorry if this has already been fixed