Skip to content

Conversation

tobiasdiez
Copy link
Member

@tobiasdiez tobiasdiez commented Apr 9, 2025

@tobiasdiez tobiasdiez enabled auto-merge April 9, 2025 15:29
@tobiasdiez
Copy link
Member Author

tobiasdiez commented Apr 10, 2025

@tobiasdiez tobiasdiez added the status: blocked Blocked by an issue / missing feature of a dependency, or by another issue label Apr 10, 2025
@tobiasdiez tobiasdiez marked this pull request as draft April 10, 2025 01:49
auto-merge was automatically disabled April 10, 2025 01:49

Pull request was converted to draft

@jkomyno
Copy link

jkomyno commented Aug 18, 2025

Hey, Alberto from Prisma here.
I was able to fix the Prisma-related errors mentioned in prisma/prisma#26880 (comment) by applying the following changes:

  • Remove your custom pnpm patch of prisma
  • Remove experimental: { wasm: true } from nuxt.config.ts
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 5e613d5c..e4213d2d 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -31,9 +31,6 @@ export default defineNuxtConfig({
         },
       },
     },
-    experimental: {
-      wasm: true,
-    },
   },
 
   experimental: {
diff --git a/package.json b/package.json
index bc5e1587..a6920aad 100644
--- a/package.json
+++ b/package.json
@@ -163,8 +163,7 @@
     "patchedDependencies": {
       "mount-vue-component": "patches/[email protected]",
       "@vue/apollo-util": "patches/@[email protected]",
-      "nitropack": "patches/[email protected]",
-      "prisma": "patches/prisma.patch"
+      "nitropack": "patches/[email protected]"
     },
     "onlyBuiltDependencies": [
       "@prisma/client",
diff --git a/patches/prisma.patch b/patches/prisma.patch
deleted file mode 100644
index 3ecd4647..00000000
--- a/patches/prisma.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/build/index.js b/build/index.js
-index 3fcf846eebf718e0c179cc232fc255b77edeba3e..4952c45eb3389800d585c5d78e74c35ee307bba4 100644
---- a/build/index.js
-+++ b/build/index.js
-@@ -2276,15 +2276,7 @@ config.runtimeDataModel = JSON.parse(${JSON.stringify(a)})`}function Wwt(){retur
-   getRuntime: async () => await import(${JSON.stringify(l)}),
- 
-   getQuery${u}WasmModule: async () => {
--    ${Wwt()}
--  
--    // Note: we must use dynamic imports here to avoid bundling errors like \`Module parse failed: Unexpected character '' (1:0)\`.
--    const { readFile } = await dynamicRequireFn('node:fs/promises')
--    ${Vwt(o)}
--    const wasmModulePath = _require.resolve(${JSON.stringify(p)})
--    const wasmModuleBytes = await readFile(wasmModulePath)
--
--    return new globalThis.WebAssembly.Module(wasmModuleBytes)
-+    return await import(${JSON.stringify(p + '?module')}).then(r => r.default || r);
-   }
- }`;if(g){let v=i==="edge-light"?`${p}?module`:p;return`config.${r}Wasm = {
-   getRuntime: async () => await import(${JSON.stringify(l)}),
-@@ -2504,7 +2496,7 @@ ${u.length>0?`${u.join(`
- `;let n=`import * as process from 'node:process'
- import * as path from 'node:path'
- `;return e==="esm"&&(n+=`import { fileURLToPath } from 'node:url'
--const __dirname = path.dirname(fileURLToPath(import.meta.url))
-+const __dirname = "DOESNOTEXIST"
- `),n}var uEt=`/**
-  * This file exports various common sort, input & filter types that are not directly linked to a particular model.
-  *
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d1d8fe26..bc1104f5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -14,9 +14,6 @@ patchedDependencies:
   nitropack:
     hash: 69b19a740f02cf354192a66eff03eaeed5289bfe9c883c0ea383046aedbd107c
     path: patches/[email protected]
-  prisma:
-    hash: e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5
-    path: patches/prisma.patch
 
 importers:
 
@@ -54,7 +51,7 @@ importers:
         version: 6.14.0
       '@prisma/client':
         specifier: 6.14.0
-        version: 6.14.0([email protected](patch_hash=e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5)([email protected])([email protected]))([email protected])
+        version: 6.14.0([email protected]([email protected])([email protected]))([email protected])
       '@variantjs/core':
         specifier: 0.0.90
         version: 0.0.90
@@ -304,7 +301,7 @@ importers:
         version: 4.2.0([email protected])([email protected])([email protected]([email protected]))
       prisma:
         specifier: 6.14.0
-        version: 6.14.0(patch_hash=e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5)([email protected])([email protected])
+        version: 6.14.0([email protected])([email protected])
       storybook:
         specifier: 9.1.1
         version: 9.1.1(@testing-library/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
@@ -13022,9 +13019,9 @@ snapshots:
     transitivePeerDependencies:
       - pg-native
 
-  '@prisma/[email protected]([email protected](patch_hash=e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5)([email protected])([email protected]))([email protected])':
+  '@prisma/[email protected]([email protected]([email protected])([email protected]))([email protected])':
     optionalDependencies:
-      prisma: 6.14.0(patch_hash=e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5)([email protected])([email protected])
+      prisma: 6.14.0([email protected])([email protected])
       typescript: 5.7.2
 
   '@prisma/[email protected]([email protected])':
@@ -19132,7 +19129,7 @@ snapshots:
     dependencies:
       parse-ms: 4.0.0
 
-  [email protected](patch_hash=e52fdf479eb72016a152e181ceae7a0a20b7bf84da45a174059f5e8df81956c5)([email protected])([email protected]):
+  [email protected]([email protected])([email protected]):
     dependencies:
       '@prisma/config': 6.14.0([email protected])
       '@prisma/engines': 6.14.0

You can save the patch file above as fix-prisma.patch, and then run git apply fix-prisma.patch in your local branch.


I also encourage you to migrate to Prisma Config, which has been GAd a couple minor versions ago, and is also going to be the default configuration strategy for Prisma 7.

@tobiasdiez tobiasdiez force-pushed the prisma-new-generator branch from b42aa4a to 1ca4e5d Compare August 18, 2025 11:31
Copy link

github-actions bot commented Aug 18, 2025

@tobiasdiez
Copy link
Member Author

tobiasdiez commented Aug 18, 2025

@jkomyno Thanks a lot for looking into this. Your patch worked indeed nicely to fix the build. However, I still had to patch out the __dirname in prisma since otherwise I would get in pnpm build:azure (was reported already in prisma/prisma#26857):

[error] File URL path must be absolute
  at getPathFromURLWin32 (node:internal/url:1487:11)
  at fileURLToPath (node:internal/url:1610:35)
  at /D:/Programming/JabRefOnline/.nuxt/prerender/chunks/_/nitro.mjs:1124:32
  at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
  at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
  at async prerender (/D:/Programming/JabRefOnline/node_modules/.pnpm/[email protected]_patch_hash_a2c4e1e3d29c22d0e21fe199000cb730/node_modules/nitropack/dist/core/index.mjs:1892:44)
  at async /D:/Programming/JabRefOnline/node_modules/.pnpm/[email protected]_@azure+identity_317d4f5954cd67ff24a5ceddc4882335/node_modules/nuxt/dist/index.mjs:4212:5
  at async build (/D:/Programming/JabRefOnline/node_modules/.pnpm/[email protected]_@azure+identity_317d4f5954cd67ff24a5ceddc4882335/node_modules/nuxt/dist/index.mjs:6572:3)
  at async Object.run (/D:/Programming/JabRefOnline/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/build.mjs:91:5)
  at async runCommand$1 (/D:/Programming/JabRefOnline/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.VcyMLvO6.mjs:1767:16)

This rude patch works for the build, but at runtime I get the following error (without any further details):

"PrismaClientKnownRequestError: ",
          "Invalid `prisma.user.findUnique()` invocation:",
          "",
          "",
          "",
          "    at di.handleRequestError (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:7283)",
          "    at di.handleAndLogRequestError (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:6608)",
          "    at di.request (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:81:6315)",
          "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
          "    at async a (C:\\home\\site\\wwwroot\\functions\\node_modules\\@prisma\\client\\runtime\\client.js:90:9551)",
          "    at async AuthService.getUserById (file:///C:/home/site/wwwroot/functions/chunks/_/nitro.mjs:7008:12)",
          "    at async Query.user (file:///C:/home/site/wwwroot/functions/chunks/_/nitro.mjs:7408:12)"
        ]

(see failing check here in this PR)

Do you have any idea how to fix this?

@ineshbose
Copy link

I was able to progress after referring to the solution on this thread this morning, and now I am stuck here! nuxt/nuxt#32990

@tobiasdiez
Copy link
Member Author

@jkomyno I've played around with the examples in the prisma-example repo and none of them are working for me at the moment. Would be nice if you could have a look.

(and a few smaller fixes in prisma/prisma-examples#8282 should be ready to go)

@tobiasdiez tobiasdiez removed the status: blocked Blocked by an issue / missing feature of a dependency, or by another issue label Sep 7, 2025
@tobiasdiez tobiasdiez marked this pull request as ready for review September 7, 2025 09:00
@tobiasdiez tobiasdiez merged commit 23780c4 into main Sep 7, 2025
5 checks passed
@tobiasdiez tobiasdiez deleted the prisma-new-generator branch September 7, 2025 09:00
@tobiasdiez
Copy link
Member Author

@jkomyno Thanks a lot for your work on the Nuxt support. I was now able to run it successfully also in production.

Two minor issues that I solved by relatively small patches to prisma (see this branch) are prisma/prisma#28055 and prisma/prisma#26857.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants