Comments (7)
Hello @dac09 - thanks for looking into it!
Using your project and yarn rw test web
- no error when i run from a system terminal
- same error when running from vscode terminal
I have tried to remove all launch configuration + all extensions in vscode, still hitting the same error. Both terminals are using zsh and node 20 installed through nvm
It seems @redwoodjs/auth module is not loaded properly (only useAuth and createAuthentication are available in the watcher). Just to confirm, I only see the issue with rw>=7.4. Could it be the new esm/cjs change ?
from redwood.
OK, so my mistake🙈: I was using my test project, not yours when testing in vscode (they are similar except for this RedwoodApolloProvder wrapping the HomePage).
So now vscode and the terminal are consistent.
The issue boils down to the RedwoodApolloProvider we instantiate in a TestWrapper for several of our tests. I had added it to my test project to isolate the issue.
When I add the same to your test project, I get the same error stack including the error message below
Error name: "TypeError" Error message: "useAuth is not a function"
So the bifurcation is: when RedwoodApolloProvider is invoked either in a jest TestWrapper or inside a test without a useAuth prop:
-RW<7.4 is fine with no prop for useAuth
-RW>=7.4 fails because useNoAuth in undefined
This is not a blocking issue for us as I can set the useAuth of RedwoodApolloProvider to the useAuth implementation of our auth provider in my tests
Thanks!
from redwood.
Thanks for your issue report. Without any way to reproduce this it's going to be difficult to find a fix unfortunately. But I'll definitely keep this in mind if more issues like this starts popping up
from redwood.
Hi @Tobbe, I think I narrowed down the issue.
RedwoodApolloProvider has a default for useAuth = _auth.useNoAuth. Somehow this default is not working anymore.
I have added the steps to reproduce above
from redwood.
Hey @cadlagtrader - thanks for the issue and the steps!
So I followed your steps -
- created new project
- setup dbAuth
yarn rw setup auth dbAuth
- generated homepage
yarn rw g HomePage /
- ran web unit tests
yarn rw test web
andyarn rw test web --no-watch
Version i used is : "7.4.3"
but don't really see an error
Suggestions to try:
- see if you can reproduce the issue in my project above. If you can't it might be something specific to your project
- remove and reinstall all node_modules, and see if the problem persists (basically turn it off and on again 🤣)
- if you're still encountering issues could you please PR into my repo, or create a new one so we can debug a little better!
from redwood.
Heyooo, so I tried the same thing in both vscode terminal (zsh also) - and the javascript debugger terminal, still can't see it error out!
For reference I'm using Volta, and tried Node v20.10.10 and v20.12.2, and v20.11.1 to check.
Could totally be the esm/cjs change (kind of has to be!). There's a little hint in your screenshot too, where it says __esModule: true
. Trying to understand why it might be picking up esm instead of cjs.
I just noticed you had an extra step here:
> render(
> <RedwoodApolloProvider>
> <HomePage />
> </RedwoodApolloProvider>
> )
I get all sorts of errors after I did this. Imported from import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'
- When you got the error, did you change the test also? Or just left the render as is?
- Could you help me understand why you're wrapping in ApolloProvider?
- Where is RedwoodApolloProvider imported from? This could tell us where this esm stuff is coming from!
from redwood.
Thanks for getting back and the break down @cadlagtrader ✌️✌️✌️
I'm closing the issue as there is a resolution in your comment here: #10500 (comment)
if anyone else comes across this again, or would like to help debug further please feel free to comment and we can reopen the issue.
from redwood.
Related Issues (20)
- [Auth] Common AuthProvider & use* changes for middleware auth HOT 1
- [OG] Finish OG Image generation with updated middleware implementation HOT 1
- [Auth] Implement dbAuth middleware
- [Auth] createMiddlewareAuth (web side) for dbAuth
- [Auth] Implement POST handlers for login, signup, etc. on dbAuth
- [Bug?]: dbAuth `userAttributes` comment error HOT 7
- [Bug?]: Uploading files through custom functions doesn't work HOT 1
- [Bug?]: Updating from 7.3.0 to 7.4.1 will fail, if there is no npx available HOT 4
- [Bug?]: console prints wrong GraphQL endpoint when apiGraphQLUrl is set in dev enviornment HOT 4
- [Bug?]: client-build-manifest.json needs an import assertion of type "json" when using RSC HOT 6
- [Bug?]: ERROR Function "" was not found. HOT 8
- [Bug?]: HydrateRoot and TypeError: Cannot read properties of undefined ... at Object.prerenderLoader on whichever page first loads HOT 5
- [Bug?]: Seeing 500s due to ERR_STREAM_PREMATURE_CLOSE after upgrade to 7.x HOT 4
- [Bug?]: fastify compress plugin not working as per docs HOT 2
- [Bug?]: nftPack: undefined is not a function HOT 9
- [Bug?]: Authentication Error After Upgrading from Version 6.6.4 to 7.4.3 HOT 3
- [Docs]: useCache!!! HOT 1
- [Bug?]: Setting --verbose when deploying to baremetal "fails" during cleanup step. SshExecutor.js does not check that "args" is defined. HOT 6
- [Bug?]: yarn rw setup auth supabase not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redwood.