Redwood v7.0.0 Upgrade Guide

Just a quick update on my findings. I am not able to get global decorators or anything to work that would be picked up from the preview file. I tried the example from redwood, the example from storybook and several others and nothing seems to work.

Storybook example:

export default {
   decorators: [
  (Story) => (
    <div style={{ margin: '48px' }}>
      <Story />
    </div>
  ),
]
}

Redwood example:

export const decorators = [
  (Story) => (
    <div style={{ margin: '48px' }}>
      <Story />
    </div>
  ),
]
	"resource": "../web/tsconfig.json",
	"owner": "typescript",
	"severity": 8,
	"message": "Cannot find type definition file for 'jest-dom'.\n  The file is in the program because:\n    Entry point of type library 'jest-dom' specified in compilerOptions",}]

Have a Cannot find typed definition for jest-dom error

Wanted to give the core team a big shoutout for this upgrade guide. Everything took < 10 mins, without any hiccups, from local to prod (on vercel). Great job!

2 Likes

Thank you for dropping the note of praise. Although I had nothing to do with any of the updates, it is very nice to hear this. I am glad it worked out so well.

My thanks again :slight_smile: :pray:

1 Like

Is anyone else seeing scenarios loosing deeper nested (create calls) over each test run?

I just upgraded to v7 and I get this error when I run yarn rw studio

My schema.prisma by default doesn’t specify the binaryTargets and even when I specify it and add “darwin”, it still fails.

And I noticed the command yarn rw prisma studio still works whereas yarn rw studio fails below.

What’s the significant differences between these two commands?

In addition, I noticed the server for RW v7 uses Prisma 5.9.1 but the yarn rw studio command registers 5.7.0… Could this be the cause?

1 Like

Thanks @evansibok! There’s a bug right now with the current version of studio which is the issue you are seeing. I’ll update here again once we have a patched version out that fixes the hardcoded platform support. Hopefully we’ll get this out in the next day or so.

The prisma studio is a feature from prisma that lets you browse the structure and data that’s inside your database, as well as letting you edit it manually from the browser. Redwoods own studio doesn’t have this feature but has a whole bunch of others. Including mailer integration, DB and graphql schema visualisation, and opentelemetry browsing.

Got it! Thank you :grinning:

1 Like

I’m experiencing a similar challenge.

I’m trying to use the new Prisma studio, and while I can see my graphql schema and it shows my development server is connected, I get an error any time I try to run a GraphQL query in the GraphQL playground. Every query (even for the redwood version) gives a FST_REPLY_FROM_SERVICE_UNAVAILABLE. The studio logs are showing Error: getaddrinfo ENOTFOUND undefined\n at GetAddrInfoReqWrap.onlookupall The dev server logs don’t show anything, so it appears the request isn’t making it out of the studio. I’m running 7.0.2, with a postgres database, and using netlify for authentication. Any idea what I’m doing wrong or may have misconfigured? I’ve tried @skipAuth too, so it doesn’t seem to be auth related - it can’t even query the redwoodjs version.

If I go to localhost:8911/graphql, I can query my endpoint just fine. I don’t see anything in my dev server logs either.

1 Like

That was also another bug on our end, sorry! I’ve already merged a patch in and we’ll try to get a patched version of studio out soon.

1 Like

Is anyone else seeing an issue with requireAuth() not receiving the context after upgrading? I’m running on Netlify (upgraded to node v20).

export const requireAuth = ({ roles } = {}) => {
  console.log('requireAuth', roles, context)
  if (!isAuthenticated()) {
    throw new AuthenticationError("You don't have permission to do that.")
  }

  if (roles && !hasRole(roles)) {
    throw new ForbiddenError("You don't have access to do that.")
  }
}

My console.log() is returning:

requireAuth undefined {}

The site works fine locally. Also, I am using Clerk for auth.

Seems to be specifically here that’s not receiving the context variable:

export const isAuthenticated = () => {
  return !!context.currentUser
}

Downgrading to 6.6.4 seems to resolve the issue.

1 Like

Did you see the updates you have to make to your tsconfig file?

1 Like

I’m having the same issue with Azure Active Directory authentication.

context.currentUser returns undefined, but I can console.log(context.currentUser) without issue. It shows as a type of object with 5 keys, but when accessing the keys via context[‘key’] or context.key it returns undefined. All of the user data is in the context when logged to console, I snipped out pieces in the log below to shorten for this post.

export const isAuthenticated = () => {
  console.log("-----------context-------------")
  console.log(typeof context)
  console.log(Object.keys(context))
  console.log(context)
  console.log("context request")
  console.log(context['request'])
  console.log("params")
  console.log(context['params'])
  console.log("current user")
  console.log(context['currentUser'])
  console.log("event")
  console.log(context['event'])
  console.log("request context")
  console.log(context['requestContext'])
  return !!context.currentUser
}

Displays the context in console.log, but nothing is accessible:

-----------context-------------
object
[ 'request', 'params', 'currentUser', 'event', 'requestContext' ]
{
  request: PonyfillRequest {
    bodyInit: 
    options: {
      method: 'POST',
    },
    TRUNCATED FOR POST BREVITY
  },
  params: {
    query: 'query __REDWOOD__AUTH_GET_CURRENT_USER { redwood { currentUser } }'
  },
  currentUser: {
    aud: '-------',
    iss: 'https://login.microsoftonline.com/'
	REDACTED AND TRUNCATED FOR POST BREVITY
  },
  event: {
    httpMethod: 'POST',
    headers: {
      'sec-fetch-site': 'same-origin',
      authorization: 'Bearer eyJ0eXAiOi'
	  TRUNCATED AND REDACTED FOR POST BREVITY
    },
    path: '/graphql',
    queryStringParameters: {},
    isBase64Encoded: false
  },
  requestContext: { callbackWaitsForEmptyEventLoop: false }
}
context request
undefined
params
undefined
current user
undefined
event
undefined
request context
undefined
2 Likes

@Josh-Walker-GM fwiw, this still isn’t working for me on 7.0.6. I just made a vanilla project, and I get the same error. Also, it seems on 7.0.6, the yarn rw studio command seems to fail now due to trying to install in a default workspace:

(base) martin@Martins-MBP studio-test % yarn rw studio
yarn run v1.22.19
$ /Users/martin/Code/studio-test/node_modules/.bin/rw studio
The studio package is not installed, installing it for you, this may take a moment...
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Cannot start the development studio
Error: Command failed with exit code 1: yarn add -D @redwoodjs/studio@11
    at makeError (/Users/martin/Code/studio-test/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/martin/Code/studio-test/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async installModule (/Users/martin/Code/studio-test/node_modules/@redwoodjs/cli/dist/lib/packages.js:37:5)
    at async handler (/Users/martin/Code/studio-test/node_modules/@redwoodjs/cli/dist/commands/studioHandler.js:23:7)
    at async runYargs (/Users/martin/Code/studio-test/node_modules/@redwoodjs/cli/dist/index.js:191:3)
    at async /Users/martin/Code/studio-test/node_modules/@redwoodjs/cli/dist/index.js:142:7
    at async main (/Users/martin/Code/studio-test/node_modules/@redwoodjs/cli/dist/index.js:123:3) {
  shortMessage: 'Command failed with exit code 1: yarn add -D @redwoodjs/studio@11',
  command: 'yarn add -D @redwoodjs/studio@11',
  escapedCommand: 'yarn add -D "@redwoodjs/studio@11"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(base) martin@Martins-MBP studio-test % yarn add -D "@redwoodjs/studio@11"

(base) martin@Martins-MBP studio-test % yarn rw studio
yarn run v1.22.19
$ /Users/martin/Code/studio-test/node_modules/.bin/rw studio
Cannot start the development studio
Error: Cannot find module '@redwoodjs/realtime'
Require stack:
- /Users/martin/Code/studio-test/node_modules/@redwoodjs/studio/api/dist/util/connectionWatching.js
- /Users/martin/Code/studio-test/node_modules/@redwoodjs/studio/api/dist/server.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/martin/Code/studio-test/node_modules/@redwoodjs/studio/api/dist/util/connectionWatching.js:35:23)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/martin/Code/studio-test/node_modules/@redwoodjs/studio/api/dist/util/connectionWatching.js',
    '/Users/martin/Code/studio-test/node_modules/@redwoodjs/studio/api/dist/server.js'
  ]
}

When I manually installed the dependencies, it did start though, but the Fastify FST_REPLY_FROM_SERVICE_UNAVAILABLE error remains.

1 Like

I need to release a new version of Studio. A few PRs have been merged that fixes various issues.

I’ll see if I can get to it today

2 Likes

@Tobbe Checking to see if the bug around this have been resolved as I’m still experiencing the same issue. I’m on 7.1.3 now

3 Likes

Questions around serverful and server.config.js/ts:

If running serverful, should the new command

yarn rw setup server-file

be used regardless of customization or not?

Also, should the server.config.js file be removed, even if there were no customizations?

B

2 Likes

I tried the latest version 7.1.3 and I still get this issue. Are you getting it too?

Made an issue here: [Bug?]: Upgrading to 7.1.3 - "You don't have permission to do that." · Issue #10223 · redwoodjs/redwood · GitHub

Yes I am still receiving the same issue with 7.1.x.

1 Like

Done :wink:

2 Likes