-
Notifications
You must be signed in to change notification settings - Fork 591
Description
Describe the bug
When using Next-Forge in a Turborepo monorepo, and configuring Prisma with the Neon adapter via new PrismaClient({ adapter: PrismaNeon(...) })
, the runtime throws:
“No database host or connection string was set, and key parameters have default values (host: localhost, user: ryan, db: ryan, password: null). Is an environment variable missing?”
This occurs even though DATABASE_URL
is correctly printed (via logs) and the adapter is constructed with the correct URL. It appears Prisma’s generated client runtime logic falls back to its default env parsing logic before respecting the adapter override, causing the error.
next-forge version
v5.1.1
To Reproduce
- Initialize a Next-Forge
- In packages/database/index.ts, configure Prisma with Neon adapter (default):
const pool = new Pool({ connectionString: keys()DATABASE_URL });
const adapter = new PrismaNeon(pool);
export const database = new PrismaClient({ adapter });
- Ensure
apps/app/.env.local
andpackages/database/.env
definesDATABASE_URL
. - Run
pnpm dev
and navigate to http://localhost:3000. - Attempt to sign in.
- After sign in, when redirected back to the app, you should see the runtime error:
⨯ Error: No database host or connection string was set, and key parameters have default values (host: localhost, user: ryan, db: ryan, password: null)...
Expected behavior
I expect the Prisma client to use the adapter’s connection configuration (i.e. the correct DATABASE_URL
) and execute queries successfully without falling back to default host/user logic.
Screenshots

## Error Type
Runtime Error
## Error Message
No database host or connection string was set, and key parameters have default values (host: localhost, user: ryan, db: ryan, password: null). Is an environment variable missing? Alternatively, if you intended to connect with these parameters, please set the host to 'localhost' explicitly.
at <anonymous> (../../packages/database/generated/client/runtime/library.js:9:6789)
## Code Frame
7 | `);return r.length<e?r:r.slice(-e)}function Uo(){Yr.length=0}var gr=N;var Go=O(require("node:fs"));function ai(){let e=process.env.PRISMA_QUERY_ENGINE_LIBRARY;if(!(e&&Go.default.existsSync(e))&&process.arch==="ia32")throw new Error('The default query engine type (Node-API, "library") is currently not supported for 32bit Node. Please set `engineType = "binary"` in the "generator" block of your "schema.prisma" file (or use the environment variables "PRISMA_CLIENT_ENGINE_TYPE=binary" and/or "PRISMA_CLI_QUERY_ENGINE_TYPE=binary".)')}var li=["darwin","darwin-arm64","debian-openssl-1.0.x","debian-openssl-1.1.x","debian-openssl-3.0.x","rhel-openssl-1.0.x","rhel-openssl-1.1.x","rhel-openssl-3.0.x","linux-arm64-openssl-1.1.x","linux-arm64-openssl-1.0.x","linux-arm64-openssl-3.0.x","linux-arm-openssl-1.1.x","linux-arm-openssl-1.0.x","linux-arm-openssl-3.0.x","linux-musl","linux-musl-openssl-3.0.x","linux-musl-arm64-openssl-1.1.x","linux-musl-arm64-openssl-3.0.x","linux-nixos","linux-static-x64","linux-static-arm64","windows","freebsd11","freebsd12","freebsd13","freebsd14","freebsd15","openbsd","netbsd","arm"];var Ut="libquery_engine";function Gt(e,r){let t=r==="url";return e.includes("windows")?t?"query_engine.dll.node":`query_engine-${e}.dll.node`:e.includes("darwin")?t?`${Ut}.dylib.node`:`${Ut}-${e}.dylib.node`:t?`${Ut}.so.node`:`${Ut}-${e}.so.node`}var Ko=O(require("node:child_process")),mi=O(require("node:fs/promises")),Ht=O(require("node:os"));var Oe=Symbol.for("@ts-pattern/matcher"),Gu=Symbol.for("@ts-pattern/isVariadic"),Wt="@ts-pattern/anonymous-select-key",ui=e=>!!(e&&typeof e=="object"),Qt=e=>e&&!!e[Oe],Ee=(e,r,t)=>{if(Qt(e)){let n=e[Oe](),{matched:i,selections:o}=n.match(r);return i&&o&&Object.keys(o).forEach(s=>t(s,o[s])),i}if(ui(e)){if(!ui(r))return!1;if(Array.isArray(e)){if(!Array.isArray(r))return!1;let n=[],i=[],o=[];for(let s of e.keys()){let a=e[s];Qt(a)&&a[Gu]?o.push(a):o.length?i.push(a):n.push(a)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(r.length<n.length+i.length)return!1;let s=r.slice(0,n.length),a=i.length===0?[]:r.slice(-i.length),l=r.slice(n.length,i.length===0?1/0:-i.length);return n.every((u,c)=>Ee(u,s[c],t))&&i.every((u,c)=>Ee(u,a[c],t))&&(o.length===0||Ee(o[0],l,t))}return e.length===r.length&&e.every((s,a)=>Ee(s,r[a],t))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in r||Qt(o=i)&&o[Oe]().matcherType==="optional")&&Ee(i,r[n],t);var o})}return Object.is(r,e)},Ge=e=>{var r,t,n;return ui(e)?Qt(e)?(r=(t=(n=e[Oe]()).getSelectionKeys)==null?void 0:t.call(n))!=null?r:[]:Array.isArray(e)?Zr(e,Ge):Zr(Object.values(e),Ge):[]},Zr=(e,r)=>e.reduce((t,n)=>t.concat(r(n)),[]);function pe(e){return Object.assign(e,{optional:()=>Qu(e),and:r=>q(e,r),or:r=>Wu(e,r),select:r=>r===void 0?Qo(e):Qo(r,e)})}function Qu(e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return r===void 0?(Ge(e).forEach(i=>n(i,void 0)),{matched:!0,selections:t}):{matched:Ee(e,r,n),selections:t}},getSelectionKeys:()=>Ge(e),matcherType:"optional"})})}function q(...e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return{matched:e.every(i=>Ee(i,r,n)),selections:t}},getSelectionKeys:()=>Zr(e,Ge),matcherType:"and"})})}function Wu(...e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return Zr(e,Ge).forEach(i=>n(i,void 0)),{matched:e.some(i=>Ee(i,r,n)),selections:t}},getSelectionKeys:()=>Zr(e,Ge),matcherType:"or"})})}function A(e){return{[Oe]:()=>({match:r=>({matched:!!e(r)})})}}function Qo(...e){let r=typeof e[0]=="string"?e[0]:void 0,t=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return pe({[Oe]:()=>({match:n=>{let i={[r??Wt]:n};return{matched:t===void 0||Ee(t,n,(o,s)=>{i[o]=s}),selections:i}},getSelectionKeys:()=>[r??Wt].concat(t===void 0?[]:Ge(t))})})}function ye(e){return typeof e=="number"}function Ve(e){return typeof e=="string"}function je(e){return typeof e=="bigint"}var eg=pe(A(function(e){return!0}));var Be=e=>Object.assign(pe(e),{startsWith:r=>{return Be(q(e,(t=r,A(n=>Ve(n)&&n.startsWith(t)))));var t},endsWith:r=>{return Be(q(e,(t=r,A(n=>Ve(n)&&n.endsWith(t)))));var t},minLength:r=>Be(q(e,(t=>A(n=>Ve(n)&&n.length>=t))(r))),length:r=>Be(q(e,(t=>A(n=>Ve(n)&&n.length===t))(r))),maxLength:r=>Be(q(e,(t=>A(n=>Ve(n)&&n.length<=t))(r))),includes:r=>{return Be(q(e,(t=r,A(n=>Ve(n)&&n.includes(t)))));var t},regex:r=>{return Be(q(e,(t=r,A(n=>Ve(n)&&!!n.match(t)))));var t}}),rg=Be(A(Ve)),be=e=>Object.assign(pe(e),{between:(r,t)=>be(q(e,((n,i)=>A(o=>ye(o)&&n<=o&&i>=o))(r,t))),lt:r=>be(q(e,(t=>A(n=>ye(n)&&n<t))(r))),gt:r=>be(q(e,(t=>A(n=>ye(n)&&n>t))(r))),lte:r=>be(q(e,(t=>A(n=>ye(n)&&n<=t))(r))),gte:r=>be(q(e,(t=>A(n=>ye(n)&&n>=t))(r))),int:()=>be(q(e,A(r=>ye(r)&&Number.isInteger(r)))),finite:()=>be(q(e,A(r=>ye(r)&&Number.isFinite(r)))),positive:()=>be(q(e,A(r=>ye(r)&&r>0))),negative:()=>be(q(e,A(r=>ye(r)&&r<0)))}),tg=be(A(ye)),Ue=e=>Object.assign(pe(e),{between:(r,t)=>Ue(q(e,((n,i)=>A(o=>je(o)&&n<=o&&i>=o))(r,t))),lt:r=>Ue(q(e,(t=>A(n=>je(n)&&n<t))(r))),gt:r=>Ue(q(e,(t=>A(n=>je(n)&&n>t))(r))),lte:r=>Ue(q(e,(t=>A(n=>je(n)&&n<=t))(r))),gte:r=>Ue(q(e,(t=>A(n=>je(n)&&n>=t))(r))),positive:()=>Ue(q(e,A(r=>je(r)&&r>0))),negative:()=>Ue(q(e,A(r=>je(r)&&r<0)))}),ng=Ue(A(je)),ig=pe(A(function(e){return typeof e=="boolean"})),og=pe(A(function(e){return typeof e=="symbol"})),sg=pe(A(function(e){return e==null})),ag=pe(A(function(e){return e!=null}));var ci=class extends Error{constructor(r){let t;try{t=JSON.stringify(r)}catch{t=r}super(`Pattern matching error: no pattern matches value ${t}`),this.input=void 0,this.input=r}},pi={matched:!1,value:void 0};function hr(e){return new di(e,pi)}var di=class e{constructor(r,t){this.input=void 0,this.state=void 0,this.input=r,this.state=t}with(...r){if(this.state.matched)return this;let t=r[r.length-1],n=[r[0]],i;r.length===3&&typeof r[1]=="function"?i=r[1]:r.length>2&&n.push(...r.slice(1,r.length-1));let o=!1,s={},a=(u,c)=>{o=!0,s[u]=c},l=!n.some(u=>Ee(u,this.input,a))||i&&!i(this.input)?pi:{matched:!0,value:t(o?Wt in s?s[Wt]:s:this.input,this.input)};return new e(this.input,l)}when(r,t){if(this.state.matched)return this;let n=!!r(this.input);return new e(this.input,n?{matched:!0,value:t(this.input,this.input)}:pi)}otherwise(r){return this.state.matched?this.state.value:r(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new ci(this.input)}run(){return this.exhaustive()}returnType(){return this}};var Ho=require("node:util");var Ju={warn:Ie("prisma:warn")},Ku={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function Jt(e,...r){Ku.warn()&&console.warn(`${Ju.warn} ${e}`,...r)}var Hu=(0,Ho.promisify)(Ko.default.exec),ee=gr("prisma:get-platform"),Yu=["1.0.x","1.1.x","3.0.x"];async function Yo(){let e=Ht.default.platform(),r=process.arch;if(e==="freebsd"){let s=await Yt("freebsd-version");if(s&&s.trim().length>0){let l=/^(\d+)\.?/.exec(s);if(l)return{platform:"freebsd",targetDistro:`freebsd${l[1]}`,arch:r}}}if(e!=="linux")return{platform:e,arch:r};let t=await Zu(),n=await sc(),i=ec({arch:r,archFromUname:n,familyDistro:t.familyDistro}),{libssl:o}=await rc(i);return{platform:"linux",libssl:o,arch:r,archFromUname:n,...t}}function zu(e){let r=/^ID="?([^"\n]*)"?$/im,t=/^ID_LIKE="?([^"\n]*)"?$/im,n=r.exec(e),i=n&&n[1]&&n[1].toLowerCase()||"",o=t.exec(e),s=o&&o[1]&&o[1].toLowerCase()||"",a=hr({id:i,idLike:s}).with({id:"alpine"},({id:l})=>({targetDistro:"musl",familyDistro:l,originalDistro:l})).with({id:"raspbian"},({id:l})=>({targetDistro:"arm",familyDistro:"debian",originalDistro:l})).with({id:"nixos"},({id:l})=>({targetDistro:"nixos",originalDistro:l,familyDistro:"nixos"})).with({id:"debian"},{id:"ubuntu"},({id:l})=>({targetDistro:"debian",familyDistro:"debian",originalDistro:l})).with({id:"rhel"},{id:"centos"},{id:"fedora"},({id:l})=>({targetDistro:"rhel",familyDistro:"rhel",originalDistro:l})).when(({idLike:l})=>l.includes("debian")||l.includes("ubuntu"),({id:l})=>({targetDistro:"debian",familyDistro:"debian",originalDistro:l})).when(({idLike:l})=>i==="arch"||l.includes("arch"),({id:l})=>({targetDistro:"debian",familyDistro:"arch",originalDistro:l})).when(({idLike:l})=>l.includes("centos")||l.includes("fedora")||l.includes("rhel")||l.includes("suse"),({id:l})=>({targetDistro:"rhel",familyDistro:"rhel",originalDistro:l})).otherwise(({id:l})=>({targetDistro:void 0,familyDistro:void 0,originalDistro:l}));return ee(`Found distro info:
8 | ${JSON.stringify(a,null,2)}`),a}async function Zu(){let e="/etc/os-release";try{let r=await mi.default.readFile(e,{encoding:"utf-8"});return zu(r)}catch{return{targetDistro:void 0,familyDistro:void 0,originalDistro:void 0}}}function Xu(e){let r=/^OpenSSL\s(\d+\.\d+)\.\d+/.exec(e);if(r){let t=`${r[1]}.x`;return zo(t)}}function Wo(e){let r=/libssl\.so\.(\d)(\.\d)?/.exec(e);if(r){let t=`${r[1]}${r[2]??".0"}.x`;return zo(t)}}function zo(e){let r=(()=>{if(Xo(e))return e;let t=e.split(".");return t[1]="0",t.join(".")})();if(Yu.includes(r))return r}function ec(e){return hr(e).with({familyDistro:"musl"},()=>(ee('Trying platform-specific paths for "alpine"'),["/lib","/usr/lib"])).with({familyDistro:"debian"},({archFromUname:r})=>(ee('Trying platform-specific paths for "debian" (and "ubuntu")'),[`/usr/lib/${r}-linux-gnu`,`/lib/${r}-linux-gnu`])).with({familyDistro:"rhel"},()=>(ee('Trying platform-specific paths for "rhel"'),["/lib64","/usr/lib64"])).otherwise(({familyDistro:r,arch:t,archFromUname:n})=>(ee(`Don't know any platform-specific paths for "${r}" on ${t} (${n})`),[]))}async function rc(e){let r='grep -v "libssl.so.0"',t=await Jo(e);if(t){ee(`Found libssl.so file using platform-specific paths: ${t}`);let o=Wo(t);if(ee(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"libssl-specific-path"}}ee('Falling back to "ldconfig" and other generic paths');let n=await Yt(`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${r}`);if(n||(n=await Jo(["/lib64","/usr/lib64","/lib","/usr/lib"])),n){ee(`Found libssl.so file using "ldconfig" or other generic paths: ${n}`);let o=Wo(n);if(ee(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"ldconfig"}}let i=await Yt("openssl version -v");if(i){ee(`Found openssl binary with version: ${i}`);let o=Xu(i);if(ee(`The parsed openssl version is: ${o}`),o)return{libssl:o,strategy:"openssl-binary"}}return ee("Couldn't find any version of libssl or OpenSSL in the system"),{}}async function Jo(e){for(let r of e){let t=await tc(r);if(t)return t}}async function tc(e){try{return(await mi.default.readdir(e)).find(t=>t.startsWith("libssl.so.")&&!t.startsWith("libssl.so.0"))}catch(r){if(r.code==="ENOENT")return;throw r}}async function ir(){let{binaryTarget:e}=await Zo();return e}function nc(e){return e.binaryTarget!==void 0}async function fi(){let{memoized:e,...r}=await Zo();return r}var Kt={};async function Zo(){if(nc(Kt))return Promise.resolve({...Kt,memoized:!0});let e=await Yo(),r=ic(e);return Kt={...e,binaryTarget:r},{...Kt,memoized:!1}}function ic(e){let{platform:r,arch:t,archFromUname:n,libssl:i,targetDistro:o,familyDistro:s,originalDistro:a}=e;r==="linux"&&!["x64","arm64"].includes(t)&&Jt(`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${t}" instead). If you are using your own custom Prisma engines, you can ignore this warning, as long as you've compiled the engines for your system architecture "${n}".`);let l="1.1.x";if(r==="linux"&&i===void 0){let c=hr({familyDistro:s}).with({familyDistro:"debian"},()=>"Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.").otherwise(()=>"Please manually install OpenSSL and try installing Prisma again.");Jt(`Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-${l}".
> 9 | ${c}`)}let u="debian";if(r==="linux"&&o===void 0&&ee(`Distro is "${a}". Falling back to Prisma engines built for "${u}".`),r==="darwin"&&t==="arm64")return"darwin-arm64";if(r==="darwin")return"darwin";if(r==="win32")return"windows";if(r==="freebsd")return o;if(r==="openbsd")return"openbsd";if(r==="netbsd")return"netbsd";if(r==="linux"&&o==="nixos")return"linux-nixos";if(r==="linux"&&t==="arm64")return`${o==="musl"?"linux-musl-arm64":"linux-arm64"}-openssl-${i||l}`;if(r==="linux"&&t==="arm")return`linux-arm-openssl-${i||l}`;if(r==="linux"&&o==="musl"){let c="linux-musl";return!i||Xo(i)?c:`${c}-openssl-${i}`}return r==="linux"&&o&&i?`${o}-openssl-${i}`:(r!=="linux"&&Jt(`Prisma detected unknown OS "${r}" and may not work as expected. Defaulting to "linux".`),i?`${u}-openssl-${i}`:o?`${o}-openssl-${l}`:`${u}-openssl-${l}`)}async function oc(e){try{return await e()}catch{return}}function Yt(e){return oc(async()=>{let r=await Hu(e);return ee(`Command "${e}" successfully returned "${r.stdout}"`),r.stdout})}async function sc(){return typeof Ht.default.machine=="function"?Ht.default.machine():(await Yt("uname -m"))?.trim()}function Xo(e){return e.startsWith("1.")}var Xt={};tr(Xt,{beep:()=>kc,clearScreen:()=>Cc,clearTerminal:()=>Ic,cursorBackward:()=>mc,cursorDown:()=>pc,cursorForward:()=>dc,cursorGetPosition:()=>hc,cursorHide:()=>Ec,cursorLeft:()=>ts,cursorMove:()=>cc,cursorNextLine:()=>yc,cursorPrevLine:()=>bc,cursorRestorePosition:()=>gc,cursorSavePosition:()=>fc,cursorShow:()=>wc,cursorTo:()=>uc,cursorUp:()=>rs,enterAlternativeScreen:()=>Dc,eraseDown:()=>Tc,eraseEndLine:()=>vc,eraseLine:()=>ns,eraseLines:()=>xc,eraseScreen:()=>gi,eraseStartLine:()=>Pc,eraseUp:()=>Sc,exitAlternativeScreen:()=>Oc,iTerm:()=>Lc,image:()=>Nc,link:()=>_c,scrollDown:()=>Ac,scrollUp:()=>Rc});var Zt=O(require("node:process"),1);var zt=globalThis.window?.document!==void 0,gg=globalThis.process?.versions?.node!==void 0,hg=globalThis.process?.versions?.bun!==void 0,yg=globalThis.Deno?.version?.deno!==void 0,bg=globalThis.process?.versions?.electron!==void 0,Eg=globalThis.navigator?.userAgent?.includes("jsdom")===!0,wg=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,xg=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,vg=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,Pg=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Xr=globalThis.navigator?.userAgentData?.platform,Tg=Xr==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Sg=Xr==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",Rg=Xr==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",Ag=Xr==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Cg=Xr==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var C="\x1B[",rt="\x1B]",yr="\x07",et=";",es=!zt&&Zt.default.env.TERM_PROGRAM==="Apple_Terminal",ac=!zt&&Zt.default.platform==="win32",lc=zt?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Zt.default.cwd,uc=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?C+(e+1)+"G":C+(r+1)+et+(e+1)+"H"},cc=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=C+-e+"D":e>0&&(t+=C+e+"C"),r<0?t+=C+-r+"A":r>0&&(t+=C+r+"B"),t},rs=(e=1)=>C+e+"A",pc=(e=1)=>C+e+"B",dc=(e=1)=>C+e+"C",mc=(e=1)=>C+e+"D",ts=C+"G",fc=es?"\x1B7":C+"s",gc=es?"\x1B8":C+"u",hc=C+"6n",yc=C+"E",bc=C+"F",Ec=C+"?25l",wc=C+"?25h",xc=e=>{let r="";for(let t=0;t<e;t++)r+=ns+(t<e-1?rs():"");return e&&(r+=ts),r},vc=C+"K",Pc=C+"1K",ns=C+"2K",Tc=C+"J",Sc=C+"1J",gi=C+"2J",Rc=C+"S",Ac=C+"T",Cc="\x1Bc",Ic=ac?`${gi}${C}0f`:`${gi}${C}3J${C}H`,Dc=C+"?1049h",Oc=C+"?1049l",kc=yr,_c=(e,r)=>[rt,"8",et,et,r,yr,e,rt,"8",et,et,yr].join(""),Nc=(e,r={})=>{let t=`${rt}1337;File=inline=1`;return r.width&&(t+=`;width=${r.width}`),r.height&&(t+=`;height=${r.height}`),r.preserveAspectRatio===!1&&(t+=";preserveAspectRatio=0"),t+":"+Buffer.from(e).toString("base64")+yr},Lc={setCwd:(e=lc())=>`${rt}50;CurrentDir=${e}${yr}`,annotation(e,r={}){let t=`${rt}1337;`,n=r.x!==void 0,i=r.y!==void 0;if((n||i)&&!(n&&i&&r.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),t+=r.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",r.length>0?t+=(n?[e,r.length,r.x,r.y]:[r.length,e]).join("|"):t+=e,t+yr}};var en=O(cs(),1);function or(e,r,{target:t="stdout",...n}={}){return en.default[t]?Xt.link(e,r):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,r):`${e} (\u200B${r}\u200B)`}or.isSupported=en.default.stdout;or.stderr=(e,r,t={})=>or(e,r,{target:"stderr",...t});or.stderr.isSupported=en.default.stderr;function wi(e){return or(e,e,{fallback:Y})}var Vc=ps(),xi=Vc.version;function Er(e){let r=jc();return r||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":e?.config.engineType==="client"?"client":Bc())}function jc(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":e==="client"?"client":void 0}function Bc(){return"library"}function vi(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}function rn(e){return{ok:!0,value:e,map(r){return rn(r(e))},flatMap(r){return r(e)}}}function sr(e){return{ok:!1,error:e,map(){return sr(e)},flatMap(){return sr(e)}}}var ds=N("driver-adapter-utils"),Pi=class{registeredErrors=[];consumeError(r){return this.registeredErrors[r]}registerNewError(r){let t=0;for(;this.registeredErrors[t]!==void 0;)t++;return this.registeredErrors[t]={error:r},t}};var tn=(e,r=new Pi)=>{let t={adapterName:e.adapterName,errorRegistry:r,queryRaw:ke(r,e.queryRaw.bind(e)),executeRaw:ke(r,e.executeRaw.bind(e)),executeScript:ke(r,e.executeScript.bind(e)),dispose:ke(r,e.dispose.bind(e)),provider:e.provider,startTransaction:async(...n)=>(await ke(r,e.startTransaction.bind(e))(...n)).map(o=>Uc(r,o))};return e.getConnectionInfo&&(t.getConnectionInfo=Gc(r,e.getConnectionInfo.bind(e))),t},Uc=(e,r)=>({adapterName:r.adapterName,provider:r.provider,options:r.options,queryRaw:ke(e,r.queryRaw.bind(r)),executeRaw:ke(e,r.executeRaw.bind(r)),commit:ke(e,r.commit.bind(r)),rollback:ke(e,r.rollback.bind(r))});function ke(e,r){return async(...t)=>{try{return rn(await r(...t))}catch(n){if(ds("[error@wrapAsync]",n),vi(n))return sr(n.cause);let i=e.registerNewError(n);return sr({kind:"GenericJs",id:i})}}}function Gc(e,r){return(...t)=>{try{return rn(r(...t))}catch(n){if(ds("[error@wrapSync]",n),vi(n))return sr(n.cause);let i=e.registerNewError(n);return sr({kind:"GenericJs",id:i})}}}var Wc=O(on());var M=O(require("node:path")),Jc=O(on()),wh=N("prisma:engines");function ms(){return M.default.join(__dirname,"../")}var xh="libquery-engine";M.default.join(__dirname,"../query-engine-darwin");M.default.join(__dirname,"../query-engine-darwin-arm64");M.default.join(__dirname,"../query-engine-debian-openssl-1.0.x");M.default.join(__dirname,"../query-engine-debian-openssl-1.1.x");M.default.join(__dirname,"../query-engine-debian-openssl-3.0.x");M.default.join(__dirname,"../query-engine-linux-static-x64");M.default.join(__dirname,"../query-engine-linux-static-arm64");M.default.join(__dirname,"../query-engine-rhel-openssl-1.0.x");M.default.join(__dirname,"../query-engine-rhel-openssl-1.1.x");M.default.join(__dirname,"../query-engine-rhel-openssl-3.0.x");M.default.join(__dirname,"../libquery_engine-darwin.dylib.node");M.default.join(__dirname,"../libquery_engine-darwin-arm64.dylib.node");M.default.join(__dirname,"../libquery_engine-debian-openssl-1.0.x.so.node");M.default.join(__dirname,"../libquery_engine-debian-openssl-1.1.x.so.node");M.default.join(__dirname,"../libquery_engine-debian-openssl-3.0.x.so.node");M.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.0.x.so.node");M.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.1.x.so.node");M.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-3.0.x.so.node");M.default.join(__dirname,"../libquery_engine-linux-musl.so.node");M.default.join(__dirname,"../libquery_engine-linux-musl-openssl-3.0.x.so.node");M.default.join(__dirname,"../libquery_engine-rhel-openssl-1.0.x.so.node");M.default.join(__dirname,"../libquery_engine-rhel-openssl-1.1.x.so.node");M.default.join(__dirname,"../libquery_engine-rhel-openssl-3.0.x.so.node");M.default.join(__dirname,"../query_engine-windows.dll.node");var Si=O(require("node:fs")),fs=gr("chmodPlusX");function Ri(e){if(process.platform==="win32")return;let r=Si.default.statSync(e),t=r.mode|64|8|1;if(r.mode===t){fs(`Execution permissions of ${e} are fine`);return}let n=t.toString(8).slice(-3);fs(`Have to call chmodPlusX on ${e}`),Si.default.chmodSync(e,n)}function Ai(e){let r=e.e,t=a=>`Prisma cannot find the required \`${a}\` system library in your system`,n=r.message.includes("cannot open shared object file"),i=`Please refer to the documentation about Prisma's system requirements: ${wi("https://pris.ly/d/system-requirements")}`,o=`Unable to require(\`${Ce(e.id)}\`).`,s=hr({message:r.message,code:r.code}).with({code:"ENOENT"},()=>"File does not exist.").when(({message:a})=>n&&a.includes("libz"),()=>`${t("libz")}. Please install it and try again.`).when(({message:a})=>n&&a.includes("libgcc_s"),()=>`${t("libgcc_s")}. Please install it and try again.`).when(({message:a})=>n&&a.includes("libssl"),()=>{let a=e.platformInfo.libssl?`openssl-${e.platformInfo.libssl}`:"openssl";return`${t("libssl")}. Please install ${a} and try again.`}).when(({message:a})=>a.includes("GLIBC"),()=>`Prisma has detected an incompatible version of the \`glibc\` C standard library installed in your system. This probably means your system may be too old to run Prisma. ${i}`).when(({message:a})=>e.platformInfo.platform==="linux"&&a.includes("symbol not found"),()=>`The Prisma engines are not compatible with your system ${e.platformInfo.originalDistro} on (${e.platformInfo.archFromUname}) which uses the \`${e.platformInfo.binaryTarget}\` binaryTarget by default. ${i}`).otherwise(()=>`The Prisma engines do not seem to be compatible with your system. ${i}`);return`${o}
| ^
10 | ${s}
11 |
12 | Details: ${r.message}`}var ys=O(hs(),1);function Ci(e){let r=(0,ys.default)(e);if(r===0)return e;let t=new RegExp(`^[ \\t]{${r}}`,"gm");return e.replace(t,"")}var bs="prisma+postgres",sn=`${bs}:`;function an(e){return e?.toString().startsWith(`${sn}//`)??!1}function Ii(e){if(!an(e))return!1;let{host:r}=new URL(e);return r.includes("localhost")||r.includes("127.0.0.1")||r.includes("[::1]")}var ws=O(Di());function ki(e){return String(new Oi(e))}var Oi=class{constructor(r){this.config=r}toString(){let{config:r}=this,t=r.provider.fromEnvVar?`env("${r.provider.fromEnvVar}")`:r.provider.value,n=JSON.parse(JSON.stringify({provider:t,binaryTargets:Kc(r.binaryTargets)}));return`generator ${r.name} {
Next.js version: 15.5.4 (Turbopack)
Desktop (please complete the following information):
- OS: macOS Sequoia 15.6.1 (24G90)
- Chrome Version 140.0.7339.134 (Official Build) (arm64)
- node v20.18.1 (also tried node v22.17.1)
Additional context / notes
- This appears related to Prisma’s fallback env resolution happening too early (in generated client runtime) and not respecting adapter injection monorepo / Next.js bundling context.
- It may also be related to a known bug/regression in newer Prisma versions where adapter-based configuration is not always honored at runtime: https://www.answeroverflow.com/m/1359686818790113311, No database host or connection string was set, and key parameters have default values prisma/prisma#27417
- I tried downgrading to Prisma 6.5.0 (per above bugs) with no effect.
I've been trying things for nearly a whole day on this and haven't gotten anywhere.