Redwood v8.0.0 Upgrade Guide

Thanks for the offer @Tobbe. I decided to take the shortest path to resolve the issue for now, so I forked the docx package and made a couple of changes, including telling the package not to build as an ESM module. Now I can load the package statically, along with the types as well, and all is well. Of course, this references the package from a forked github repo rather than npm, which is not ideal, and thus, this is a temporary solution.

As a side note, I never did figure out why the base docx package behaves as a CommonJS package in Redwood v7.x. (I suspect the tsx version update in RW V8ā€¦ but I havenā€™t confirmed.) Now, in V8, the base docx package behaved like an ESM module (which it should), along with all the issues that ESM currently brings into NodeJS applications. My future hope is the wider NodeJS and typescript community can help clean up some of the mud in the NodeJS/ESM world!

Thanks againā€¦ Iā€™ll let you know if I need anything else! I didnā€™t want to waste your valuable time!

1 Like

Me too! And it looks like things are moving in the right direction https://webdeveloper.beehiiv.com/p/native-support-cjsesm-interoperability-begins-nodejs-22

1 Like

I am seeing the same behavior, were you able to fix? Hereā€™s my full investigation:

Hey, Iā€™m having some issues with production deployment to vercel after upgrading from v7.7.4 to v8.2.0. The issue only shows up when deployed to vercel, local development behaves as expected. The issue is with auth/cookies not being set after the POST request to /api/auth (which does get a 200 response), but does not have the setCookie header. The subsequent GET request to /api/auth?method=getToken also has a 200 response but does not return the logged in user. This results in the user not being able to get passed the login/signup page. The behavior does not show up when developing locally. I have a test repository with the minimal changes needed to reproduce GitHub - jgal1/redwood-vercel .

v7.7.4:
- Local developemnt works
- Production deploy DOES NOT have auth issues
- Code lives in the v7.7.4 branch of the linked repo
- Vercel Deployment: See next comment new users canā€™t post more than two links on this discussionā€¦

v8.0.0:
- Local developemnt works
- Production deploy DOES have auth issues descibed above
- Code lives in the v8.0.0 branch of the linked repo
- Vercel Deployment: See next comment new users canā€™t post more than two links on this discussionā€¦

v8.2.0:
- Local developemnt works
- Production deploy DOES have auth issues descibed above
- Code lives in the main branch of the linked repo
- Vercel Deployment: See next comment new users canā€™t post more than two links on this discussionā€¦

Please let me know if you need any more information about my setup. The app is setup with a free supabase postgres instance (example format for env vars below), hosted on vercel with env vars set in the following format:
- SESSION_SECRET= secret obtained from running ā€˜yarn rw g secretā€™
- DATABASE_URL=See next comment new users canā€™t post more than two links on this discussionā€¦
- DIRECT_DATABASE_URL=See next comment new users canā€™t post more than two links on this discussionā€¦

The codebase for the reproduction lives at GitHub - jgal1/redwood-vercel . The v7.7.4 branch has the code which works for both local and vercel deployment, the v8.0.0 branch has the v8.0.0 code which does not work when deployed to vercel, and the main branch has the v8.2.0 version which also does not work when deployed to production.

To get a fresh repository for the minimal reproduction follow the below steps:

yarn create redwood-app redwood-vercel --typescript
cd redwood-vercel && yarn install
yarn rw setup ui tailwindcss
yarn rw setup auth dbAuth
yarn rw setup deploy vercel

The vercel deployment uses the standard redwood preset, and the only requirement on vercel is to set the environmental variables which are stated above.

This shouldnā€™t make any difference for this issue but for my specific case, to connect to the supabase postgres instance the schema.prisma file needs the following edit to the ā€˜datasourceā€™ config:

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_DATABASE_URL")
}

For local development, the DATABASE_URL and DIRECT_DATABASE_URL should be the same and point to a local postgres instance

Please let me know if there is anything I can do to help debug, for example any vercel permissions issues viewing the deployed domains, or vercel logs.

As a new redwood community discussion my last post couldnā€™t have more than 2 links, here is the rest of the info:

Please let me know if you need any more information about my setup. The app is setup with a free supabase postgres instance (example format for env vars below), hosted on vercel with env vars set in the following format:
- SESSION_SECRET= secret obtained from running ā€˜yarn rw g secretā€™
- DATABASE_URL=postgres://postgres.example:examplepw@aws-0-us-west-1.pooler.supabase.com:6543/postgres?sslmode=require&pgbouncer=true&connection_limit=1
- DIRECT_DATABASE_URL=postgres://postgres.example:examplepw@aws-0-us-west-1.pooler.supabase.com:5432/postgres?sslmode=require
- NODE_ENV=production

1 Like

The working deployment v7.7.4 can be tested live at https://redwood-vercel-git-v774-jgal1s-projects.vercel.app/

The broken auth deployment for v8.0.0 can be seen at https://redwood-vercel-git-v800-jgal1s-projects.vercel.app/

Do you find any solution for this ? I have the same problem and I try until 8.4.0

I check your description and this is exactly the same issue