I’m currently upgrading from 6.X to 7.1.3 and am running into an issue with running the studio in a github action (we run the studio for our UI tests in CI)
Basically, when trying to run the studio in CI, it gives the following error:
PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime “debian-openssl-1.1.x”.
This happened because Prisma Client was generated for “darwin-arm64”, but the actual deployment required “debian-openssl-1.1.x”.
For context, I am doing local development on a Mac and this is only a problem for running the studio – not running the actual app. It suggests adding “debian-openssl-1.1.x” to the binaryTargets in schema.prisma but I don’t have access to this because it’s in a dependency’s prisma.schema (or at least, I think I don’t)
Has anyone run into this? My question is obviously how to fix this. But more specifically, I’m wondering at what point the prisma client is generated for the studio? It strikes me that the engine could be hard coded somewhere that has been committed but I’ve yet to be able to find it.
Yeah I’ve had this same issue and I think a few others have mentioned something similar above. From my research, it seems like the fix is in this PR of @redwoodjs/studio, which has already been merged to the main branch. The problem is that there has not been a new tag/build of that package that includes that change. @Tobbementioned above that he was going to work on getting that done, but I haven’t seen any new tags come through.
You will find the engine in /node_modules/@redwoodjs/studio/api/db/client/
To get rw studio working locally on Mac,
Redwood version 7.3.0 (but these steps worked on RW 7.1.3)
I delete the engine at /node_modules/@redwoodjs/studio/api/db/client/
I then copy in the correct engine (for me)
from
/node_modules/.prisma/client/libquery_engine-darwin.dylib.node
to
/node_modules/@redwoodjs/studio/api/db/client/
At this point yarn rw studio works for me.
But… i still do not get the graphs
I had to install the open telemetyry
yarn rw exp setup-opentelemetry
6 And…make a fix suggested elsewhere to
node_modules/@redwoodjs/studio/api/dist/functions/otel-trace/otel-trace.js
changing two lines
from
startTimeNano: convertLongToBigInt(span.startTimeUnixNano),
endTimeNano: convertLongToBigInt(span.endTimeUnixNano),
to
startTimeNano: span.startTimeUnixNano,
endTimeNano: span.endTimeUnixNano,
Now starting the dev server (yarn rw dev) then studio (yarn rw studio) works for me.
We just released version 11.4.0 of studio. This contains some important bug fixes which should address the problems discussed here. If you could try it out and confirm everything now works that would be awesome!
Now that it seems like the studio issue maybe worked out, I gave upgrading another go and am running into an issue with global context. I am using supabase auth and my context is empty on any graphql call (and I am definitely logged in, currentUser query returns properly). Is there anything that I need to do to populate the context object?
For context, when I tried upgrading previously, this was not an issue (7.1.2) but on 7.4.3 this started happening.
Thanks for the information on this one! The context should be populated automatically - there should be no need to change context-related code when you’re upgrading your project.
It would be particularly helpful if you could confirm this issue happens not at v7.0.0 but in some minor or patch version afterward? Is this happening for you locally during rw dev / rw serve or is it when deployed?
I think hasRole is broken or the implementation of it? isAuthenticated, logOut and currentUser works though. I submitted this discord thread:
I tested this on a fresh install, here are my steps (discord has images):
yarn create redwood-app --ts ./testApp
Added User and Role models to schema
yarn rw setup auth dbAuth
yarn rw prisma migrate dev to my local sqlite db (I didn’t bother to set up my postgres production db–the issue is the same either way)
yarn rw g dbAuth to create the login flow
yarn rw g page Home
added a privateset to my routes to force the login to access home
added a new user and gave him admin role using prisma studio
added console logs to the HomePage for hasRole
still returns false
My hunch is that the models in my schema are set up as many-to-many between User and Role but the tutorial mentions to use roles as a string field. I remember in older versions of Redwood this worked fine, did v7 drop support for a Role model in favor of string? So I tried changing the models and making the roles field on User a string. Same outcome, hasRole is still returning false.
After upgrading to 7.5.0 and later 7.6.2 we experienced a problem (only on Windows) where the hot reloading in yarn rw dev was not working and we were getting the following errors:
Error after hot reloading api/
api | 16:25:40 🌲 incoming request POST xxx /graphql
api | 16:25:40 🌲 request completed 100ms
api | 16:25:40 🌲 request completed 106ms
api | 16:25:46 🌲 incoming request POST xxx /graphql
api | 16:25:46 🌲 request completed 291ms
api | 16:25:46 🌲 incoming request POST xxx /graphql
api | 16:25:46 🌲 incoming request POST xxx /graphql
api | 16:25:47 🌲 request completed 80ms
api | Took 28940 ms
api | 16:25:47 🌲 incoming request POST xxx /graphql
api | 16:25:47 🌲 incoming request POST xxx /graphql
api | 16:25:47 🌲 incoming request POST xxx /graphql
api | 16:25:47 🌲 request completed 270ms
api | Starting inspector on 127.0.0.1:18911 failed: address already in use
api | 16:25:47 🌲 request completed 146ms
api | 16:25:47 🌲 request completed 177ms
api | 16:25:47 🌲 request completed 317ms
api | Took 28389 ms
api | Starting inspector on 127.0.0.1:18911 failed: address already in use
api | Importing Server Functions...
api | ...Done importing in 1 ms
api | Importing Server Functions...
api | ...Done importing in 1 ms
api | 16:25:55 🌲 incoming request POST xxx /graphql
api | 16:25:55 🌲 request completed 239ms
api | GraphQL Yoga Server endpoint at graphql
api | GraphQL Yoga Server Health Check endpoint at graphql/health
api | GraphQL Yoga Server Readiness endpoint at graphql/readiness
api | GraphQL Yoga Server endpoint at graphql
api | GraphQL Yoga Server Health Check endpoint at graphql/health
api | GraphQL Yoga Server Readiness endpoint at graphql/readiness
api | node:net:1898
api | const ex = new UVExceptionWithHostPort(err, 'listen', address, port);
api | ^
api |
api | Error: listen EADDRINUSE: address already in use :::8911
api | at Server.setupListenHandle [as _listen2] (node:net:1898:16)
api | at listenInCluster (node:net:1946:12)
api | at doListen (node:net:2116:7)
api | at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
api | code: 'EADDRINUSE',
api | errno: -4091,
api | syscall: 'listen',
api | address: '::',
api | port: 8911
api | }
api |
api | Node.js v20.13.1
api | node:net:1898
api | const ex = new UVExceptionWithHostPort(err, 'listen', address, port);
api | ^
api |
api | Error: listen EADDRINUSE: address already in use :::8911
api | at Server.setupListenHandle [as _listen2] (node:net:1898:16)
api | at listenInCluster (node:net:1946:12)
api | at doListen (node:net:2116:7)
api | at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
api | code: 'EADDRINUSE',
api | errno: -4091,
api | syscall: 'listen',
api | address: '::',
api | port: 8911
api | }
api |
api | Node.js v20.13.1
api | 16:26:39 🌲 incoming request POST xxx /graphql
api | 16:26:40 🌲 request completed 211ms
api | 16:26:40 🌲 incoming request POST xxx /graphql
api | 16:26:40 🌲 incoming request POST xxx /graphql
api | 16:26:41 🌲 request completed 109ms
This seems to occur almost every time that I switch branches or discard changes through Git. The weird thing is that the api still works, but sometimes it doesn’t reload new code. E.g. when switching branches like in the log below in the log below new queries (SDLs, services and frontend) were added in the branch I changed over to, but they didn’t get picked up:
Hot reloading unable to recognize new code
api | 16:28:32 🚨 graphql-server Cannot query field "products" on type "Query". [Suggestion hidden]?
api | 16:28:32 🌲 request completed 7ms
api | 16:28:32 🌲 incoming request POST xxx /graphql
api | 16:28:32 🚨 graphql-server Cannot query field "tags" on type "Query". [Suggestion hidden]?
api | 16:28:32 🌲 request completed 2ms
api | 16:28:32 🌲 incoming request POST xxx /graphql
api | 16:28:32 🚨 graphql-server Cannot query field "reviews" on type "Query". [Suggestion hidden]?
api | 16:28:32 🌲 request completed 2ms
I tried deleting build files and node_modules, and reinstalling but it made no difference.
I have tried to backtrack our changes from when we upgraded from version 6 to 7. Here we swapped server.config.js for the new server.ts. We didn’t have anything custom in there so we didn’t make any changes after running yarn rw setup server-file as described in this upgrade guide. But it did not seem to cause the issues.
I’ve been busy with my job, but I have some time now so I’ll write up a change to contribute to the Docs. The solution was ultimately simple enough, but it’s not documented with a structure of user->role->permissions objects. Instead, the RBAC documentation uses strings and if anyone else wants to create their own permission system within dbAuth they will likely experience this issue as well. Thank you!
I keep getting the UNAUTHENTICATED response in my graphiQL when I perform authenticated queries.
I have the studio.graphiql.authImpersonation config set in my redwood.toml file.
Is the authImpersonation user meant to be an actual user existing in my db or any sample can work? Either way my queries still fail. I’m on Studio version 11.4.0
Hi. Yes, the impersonation must map to a real user for dbAuth. Other impersonation may be different because it depends on what the currentUser function does with the decoded token or cookie.
For dbAuth since the user is fetched from the database then that user record must exist.
❯ yarn rw lint
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0
YOUR TYPESCRIPT VERSION: 5.4.5
Please only submit bug reports when using the officially supported version.
=============
Oops! Something went wrong! :(
ESLint: 8.57.0
TypeError: Error while loading rule 'react/jsx-no-target-blank': `[[GeneratorState]]` is not present on `O`
Occurred while linting /home/userName/dev/projectName/projectName/web/src/App.tsx
at Object.assert (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/node_modules/es-iterator-helpers/node_modules/internal-slot/index.js:18:10)
at GeneratorStart (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/node_modules/es-iterator-helpers/aos/GeneratorStart.js:12:7)
at CreateIteratorFromClosure (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/node_modules/es-iterator-helpers/aos/CreateIteratorFromClosure.js:42:2)
at Array Iterator.map (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/node_modules/es-iterator-helpers/Iterator.prototype.map/implementation.js:71:15)
at Object.getLinkComponents (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/lib/util/linkComponents.js:38:18)
at Object.create (/home/userName/dev/projectName/projectName/node_modules/eslint-plugin-react/lib/rules/jsx-no-target-blank.js:180:47)
at createRuleListeners (/home/userName/dev/projectName/projectName/node_modules/eslint/lib/linter/linter.js:895:21)
at /home/userName/dev/projectName/projectName/node_modules/eslint/lib/linter/linter.js:1066:110
at Array.forEach (<anonymous>)
at runRules (/home/userName/dev/projectName/projectName/node_modules/eslint/lib/linter/linter.js:1003:34)
If you find time, please do, I might only find time after friday. Would also need to check the tests etc as it seems to be used in multiple places Code search results · GitHub and I’m unsure if that old behavior is always wrong.