Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser bundle: Unhandled Runtime Error when upgrading to 5.1.0 from 5.0.0 #20480

Closed
lipis opened this issue Aug 1, 2023 · 11 comments · Fixed by #20481
Closed

Browser bundle: Unhandled Runtime Error when upgrading to 5.1.0 from 5.0.0 #20480

lipis opened this issue Aug 1, 2023 · 11 comments · Fixed by #20481
Assignees
Labels
5.1.0 bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: browser topic: enum "type"/block `enum` topic: Next.js
Milestone

Comments

@lipis
Copy link

lipis commented Aug 1, 2023

Bug description

I just upgraded to 5.1.0 and getting an Unhandled Runtime Error, don't really know how to debug. Category is one of my enum tables in schema.

Unhandled Runtime Error
TypeError: Cannot set properties of undefined (setting 'Category')

Call Stack
eval
node_modules/.prisma/client/index-browser.js (430:42)
./node_modules/.prisma/client/index-browser.js
file:///Users/lipis/work/lim-expenses/.next/static/chunks/pages/index.js (17:1)
options.factory
/_next/static/chunks/webpack.js (707:31)
__webpack_require__
file:///Users/lipis/work/lim-expenses/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (362:21)
eval
node_modules/@prisma/client/index-browser.js (1:15)
./node_modules/@prisma/client/index-browser.js
file:///Users/lipis/work/lim-expenses/.next/static/chunks/pages/index.js (27:1)
options.factory
/_next/static/chunks/webpack.js (707:31)
__webpack_require__
file:///Users/lipis/work/lim-expenses/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (362:21)
eval
webpack-internal:///./lib/date-utils.ts (27:72)
./lib/date-utils.ts
file:///Users/lipis/work/lim-expenses/.next/static/chunks/pages/index.js (9363:1)
options.factory
/_next/static/chunks/webpack.js (707:31)
__webpack_require__
file:///Users/lipis/work/lim-expenses/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (362:21)
eval
webpack-internal:///./components/branches/BranchItem.tsx (4:73)
./components/branches/BranchItem.tsx
file:///Users/lipis/work/lim-expenses/.next/static/chunks/pages/index.js (9198:1)
options.factory
/_next/static/chunks/webpack.js (707:31)
__webpack_require__
file:///Users/lipis/work/lim-expenses/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (362:21)
eval
webpack-internal:///./pages/index.tsx (8:89)
./pages/index.tsx
file:///Users/lipis/work/lim-expenses/.next/static/chunks/pages/index.js (9493:1)
options.factory
/_next/static/chunks/webpack.js (707:31)
__webpack_require__
file:///Users/lipis/work/lim-expenses/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (362:21)
eval
node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=%2FUsers%2Flipis%2Fwork%2Flim-expenses%2Fpages%2Findex.tsx&page=%2F! (5:15)
execute
node_modules/next/dist/client/route-loader.js (233:50)

How to reproduce

Expected behavior

No response

Prisma information

generator client {
  provider = "prisma-client-js"
}

generator erd {
  provider  = "prisma-erd-generator"
  output    = "../prisma/ERD.svg"
  tableOnly = true
}

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

enum Method {
  bank
  cash
  check
  credit
  delivery
}

enum Category {
  expense
  recurrent
  report
  revenue
  salary
  share
  vendor
}

enum Duration {
  day
  week
  month
  quarter
  semester
  year
  all
}

model Config {
  id           Int    @id @default(0)
  trialDays    Int    @default(60)
  priceMonth   Int    @default(29)
  priceYear    Int    @default(299)
  priceTax     Float  @default(0)
}

...
// Add your code using Prisma Client

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: v18.17.0

Prisma Version

5.1.0
@lipis lipis added the kind/bug A reported bug. label Aug 1, 2023
@GuysmoB
Copy link

GuysmoB commented Aug 1, 2023

Same here

@Jolg42
Copy link
Member

Jolg42 commented Aug 1, 2023

@GuysmoB Could you share your error?

@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: Next.js team/client Issue for team Client. topic: enum "type"/block `enum` labels Aug 1, 2023
@SevInf SevInf self-assigned this Aug 1, 2023
@SevInf SevInf added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Aug 1, 2023
@Jolg42 Jolg42 added this to the 5.2.0 milestone Aug 1, 2023
@jharrell
Copy link
Member

jharrell commented Aug 1, 2023

@lipis thanks for the report! We've confirmed that this is an issue in 5.1.0 and are working on a patch release to resolve. We will update you here!

SevInf added a commit that referenced this issue Aug 1, 2023
$Enums namespace was correctly created for server-side clients, but not
for browser.

Fix #20480
@SevInf
Copy link
Contributor

SevInf commented Aug 1, 2023

Hi @lipis and @GuysmoB.
The fix will be a part of a patch release. You can try out integration version 5.2.0-integration-fix-enums-browser.1 meanwhile to verify that fix works for you. Normally, we don't recommend using integration version in production, however, right now this is just 5.1 with this issue fixed and it's very likely it will become 5.1.1.

Thank you for reporting the issue again!

@janpio janpio added the 5.1.0 label Aug 1, 2023
@ahkhanjani
Copy link

ahkhanjani commented Aug 1, 2023

The fix will be a part of a patch release. You can try out integration version 5.2.0-integration-fix-enums-browser.1 meanwhile to verify that fix works for you.

Hi @SevInf.
Seems to have fixed the problem.

@sunnysingh
Copy link

I have the same issue and version 5.2.0-integration-fix-enums-browser.1 fixes it.

@TomLampard
Copy link

I'm having the same issue, I tried moving back to Prisma 5.0.0 and project still bugged. How can I install this 5.2.0 integration?

@janpio
Copy link
Member

janpio commented Aug 2, 2023

npm install -D prisma@5.2.0-integration-fix-enums-browser.1
npm install @prisma/client@5.2.0-integration-fix-enums-browser.1
npx prisma generate

That should do the trick @TomLampard.

@TomLampard
Copy link

@janpio Thanks kindly

@elysiantech
Copy link

elysiantech commented Aug 2, 2023

@janpio Thanks, 5.2.0-integrations worked locally!!

However building from docker seems to revert:

=> [build  9/11] RUN npx prisma generate                                                                        16.8s
=> => # npm WARN exec The following package was not found and will be installed: prisma@5.1.0"

SevInf added a commit that referenced this issue Aug 2, 2023
* fix(client): Fix $Enums namespace in browser build

$Enums namespace was correctly created for server-side clients, but not
for browser.

Fix #20480

* Snapshots & readme

* Proper test name
SevInf added a commit that referenced this issue Aug 2, 2023
* fix(client): Fix $Enums namespace in browser build

$Enums namespace was correctly created for server-side clients, but not
for browser.

Fix #20480

* Snapshots & readme

* Proper test name
@SevInf SevInf changed the title Unhandled Runtime Error when upgrading to 5.1.0 from 5.0.0 Browser bundle: Unhandled Runtime Error when upgrading to 5.1.0 from 5.0.0 Aug 2, 2023
@SevInf
Copy link
Contributor

SevInf commented Aug 3, 2023

Fix released in 5.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.1.0 bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: browser topic: enum "type"/block `enum` topic: Next.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants