Studio binary issue on v7 upgrade

Hi there,
Just followed upgrade guide instructions but having some issues trying to run studio.

My dev os is Ubuntu 22.04.2 LTS via WSL

And the error I’m getting is below.

Added @redwoodjs/realtime to your project, as it's used by Studio
{"level":30,"time":1708442780501,"pid":194670,"hostname":"tonysmachine","msg":"Starting RedwoodJS Studio"}
(node:194670) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
{"level":30,"time":1708442780506,"pid":194670,"hostname":"tonysmachine","msg":"Migrating local Prisma database"}
/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client/runtime/library.js:67
${at(e)}`}var $d=$("prisma:client:engines:resolveEnginePath"),qd=()=>new RegExp("runtime[\\\\/]library\\.m?js$");async function dl(e,t){let r={binary:process.env.PRISMA_QUERY_ENGINE_BINARY,library:process.env.PRISMA_QUERY_ENGINE_LIBRARY}[e]??t.prismaPath;if(r!==void 0)return r;let{enginePath:n,searchedLocations:i}=await jd(e,t);if($d("enginePath",n),n!==void 0&&e==="binary"&&Di(n),n!==void 0)return t.prismaPath=n;let o=await ft(),s=t.generator?.binaryTargets??[],a=s.some(d=>d.native),l=!s.some(d=>d.value===o),u=__filename.match(qd())===null,c={searchedLocations:i,generatorBinaryTargets:s,generator:t.generator,runtimeBinaryTarget:o,queryEngineName:ml(e,o),expectedLocation:vr.default.relative(process.cwd(),t.dirname),errorStack:new Error().stack},p;throw a&&l?p=ul(c):l?p=al(c):u?p=ll(c):p=cl(c),new k(p,t.clientVersion)}async function jd(engineType,config){let binaryTarget=await ft(),searchedLocations=[],dirname=eval("__dirname"),searchLocations=[config.dirname,vr.default.resolve(dirname,".."),config.generator?.output?.value??dirname,vr.default.resolve(dirname,"../../../.prisma/client"),"/tmp/prisma-engines",config.cwd];__filename.includes("resolveEnginePath")&&searchLocations.push(Qs());for(let e of searchLocations){let t=ml(engineType,binaryTarget),r=vr.default.join(e,t);if(searchedLocations.push(e),pl.default.existsSync(r))return{enginePath:r,searchedLocations}}return{enginePath:void 0,searchedLocations}}function ml(e,t){return e==="library"?Xr(t,"fs"):`query-engine-${t}${t==="windows"?".exe":""}`}function Vn(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}var fo=F(Bi());function fl(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function gl(e){return e.split(`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^

PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".

This happened because Prisma Client was generated for "darwin-arm64", but the actual deployment required "debian-openssl-3.0.x".
Add "debian-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}

The following locations have been searched:
  /home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client
  /Users/tobbe/dev/redwood/studio/api/db/client
  /home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/.prisma/client
  /tmp/prisma-engines
  /home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db
    at dl (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client/runtime/library.js:67:805)
    at async Object.loadLibrary (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client/runtime/library.js:114:9816)
    at async zt.loadEngine (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client/runtime/library.js:116:448)
    at async zt.instantiateLibrary (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/client/runtime/library.js:115:10322) {
  clientVersion: '5.7.0',
  errorCode: undefined
}

Node.js v20.11.1

In an effort to just get it running, I’ve added the binary target string as per the error message here: /home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/studio/api/db/schema.prisma but am not sure how run prisma generate for the studio’s prisma client.

Anyone got any tips - or know where I broke my v6 to v7 upgrade?
Thanks

1 Like

Hey @littletuna4. I believe you did nothing wrong. This seems to be a bug in Redwood Studio. I opened an issue on GitHub if you want to keep track.

4 Likes