next-admin icon indicating copy to clipboard operation
next-admin copied to clipboard

[BUG] - Admin Panel Not Reflecting Prisma Schema Updates After Deploy on Vercel

Open setcubillos opened this issue 1 year ago • 9 comments

Description

Hi everyone, how are you doing? I'm facing an issue, and I'm not sure if it's directly related to the framework or Vercel. When I update the schema in Prisma, for example, by adding a new model, after deploying to Vercel, the admin panel doesn’t reflect the changes. To make it work, I have to delete the app on Vercel and recreate it from scratch. In other words, it only detects the changes from the first deploy.

Does anyone have any idea why this might be happening or how to fix it? Thanks in advance!

2024-11-28_11-12-34 (1)

Reproduction URL

https://github.com/setcubillos/web.rtms

Reproduction steps

1. Update the schema on prisma
2. deploy de app to vercel
3. Observe that the Admin panel not display the changes
4. When ad a new model the Menu not display the new model(only on Prod)

Next router

App router

Next Admin version

7.0.1

Screenshots

![DESCRIPTION]()

Next Admin options

No response

Logs

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at <unknown> (/var/task/.next/server/chunks/47.js:1:700)
    at Array.map (<anonymous>)
    at <unknown> (/var/task/.next/server/chunks/47.js:1:671)
    at r (/var/task/.next/server/chunks/47.js:1:884)
    at k (/var/task/.next/server/app/admin/[[...nextadmin]]/page.js:14:205428)
    at ek (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:13409)
    at e (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:17307)
    at eO (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:17769)
    at eO (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:17944) {
  digest: '1238321692'
}

Browsers

Chrome

setcubillos avatar Nov 28 '24 16:11 setcubillos

Description I encountered an issue when adding a new property, ranking, to the Involvement model. After updating the schema, I also included this property in my options file.

Here is an example of the update: image

The changes work perfectly in the local environment. However, in the production environment, the property does not seem to work as expected. Interestingly, if I comment out the line where the property is used, everything works fine in production.

Steps to Reproduce Add a new property (ranking) to the Involvement model. Update the options file to include the new property. Deploy the changes to the production environment.

Actual Behavior Locally: The changes work without issues. Production: The application does not function as expected unless the new property (ranking) is commented out. Additional Information The issue only arises in the production environment, not locally.

setcubillos avatar Nov 28 '24 16:11 setcubillos

Hello @setcubillos ,

When you deploy to Vercel, are you running a script that pushes your schema to your database ? Through prisma db push or prisma db migrate

foyarash avatar Nov 28 '24 16:11 foyarash

@setcubillos This is the script that are using image

setcubillos avatar Nov 28 '24 17:11 setcubillos

Can you see the new columns in your database ?

In the example app we are doing this in the vercel-build script

foyarash avatar Nov 28 '24 17:11 foyarash

Yes, the database is updated contains the new field, but the option file not reconize the new property added, image As mentioned before if comment this line then working

setcubillos avatar Nov 28 '24 17:11 setcubillos

Thanks for the details, we will have a look

foyarash avatar Nov 28 '24 17:11 foyarash

Hi @foyarash Just to let you know, I downgraded to version 6.1.8, to use the JSON schema generator and worked! image

setcubillos avatar Nov 28 '24 18:11 setcubillos

Thanks for this, guess we have an issue with the new generator then, we will investigate

foyarash avatar Nov 28 '24 19:11 foyarash

Hey @setcubillos

Sorry for the delay, I come back to this issue, do you still have the issue ?

cregourd avatar Apr 10 '25 09:04 cregourd