I’m encountering an error while using Prisma Client with a PostgreSQL database. The error message indicates that the column User.stripe_customer_id does not exist in the current database. Here are the details of my setup and the steps I’ve taken so far.
Message: Error in Prisma Client request:
Invalid `f=e.match(KCt)?.[1]??"",g=e.match(YCt)?.[1]??null,v=e.match(XCt)?.[1]??null,{getPrismaClient:E,PrismaClientKnownRequestError:x,PrismaClientRustPanicError:D,PrismaClientInitializationError:P,PrismaClientValidationError:A}=require(`${c.prismaClient}/runtime/${u}`),k=e,F=(0,bq.createHash)("sha256").update()` invocation in
C:Usershpsummelionode_modules.pnpm[email protected]node_modulesprismabuildindex.js:1969:10254
1966 }
1967 }
1968 }
→ 1969 `}});return Ye.resourceList(a.workspaces)}};var ETe=require("@prisma/engines");var ZEe=require("buffer");function e_e(e,r,n,i){Object.defineProperty(e,r,{get:n,set:i,enumerable:!0,configurable:!0})}var t_e={};e_e(t_e,"serializeRPCMessage",()=>L6);e_e(t_e,"deserializeRPCMessage",()=>M6);var F6="PrismaBigInt::",$6="PrismaBytes::";function L6(e){return JSON.stringify(e,(r,n)=>typeof n=="bigint"?F6+n:n?.type==="Buffer"&&Array.isArray(n?.data)?$6+ZEe.Buffer.from(n.data).toString("base64"):n)}function M6(e){return JSON.parse(e,(r,n)=>typeof n=="string"&&n.startsWith(F6)?BigInt(n.substr(F6.length)):typeof n=="string"&&n.startsWith($6)?n.substr($6.length):n)}var hTe=U(u_e()),UP=U(eTe()),mTe=U(require("http")),gTe=U(nTe()),vTe=require("zlib");var Co=require("path");var bq=require("crypto"),cTe=U(hq());function vq(e,r,n,i){Object.defineProperty(e,r,{get:n,set:i,enumerable:!0,configurable:!0})}var lTe=globalThis,mq={},BP={},wf=lTe.parcelRequire1308;wf==null&&(wf=function(e){if(e in mq)return mq[e].exports;if(e in BP){var r=BP[e];delete BP[e];var n={id:e,exports:{}};return mq[e]=n,r.call(n.exports,n,n.exports),n.exports}var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i},wf.register=function(r,n){BP[r]=n},lTe.parcelRequire1308=wf);var pTe=wf.register;pTe("9lTzd",function(module,exports){vq(module.exports,"guessEnginePaths",()=>guessEnginePaths),vq(module.exports,"guessPrismaClientPath",()=>guessPrismaClientPath);var $5COlq=wf("5COlq");async function guessEnginePaths({forceBinary,forceLibrary,resolveOverrides}){let queryEngineName,queryEngineType;if(forceLibrary?(queryEngineName=await(0,$5COlq.prismaEngineName)("query-engine","library"),queryEngineType="library"):forceBinary?(queryEngineName=await(0,$5COlq.prismaEngineName)("query-engine","binary"),queryEngineType="binary"):(queryEngineName=void 0,queryEngineType=void 0),!queryEngineName||!queryEngineType)return{queryEngine:void 0};let queryEnginePath;if(resolveOverrides[".prisma/client"])queryEnginePath=(0,Co.resolve)(resolveOverrides[".prisma/client"],`../${queryEngineName}`);else if(resolveOverrides["@prisma/engines"])queryEnginePath=(0,Co.resolve)(resolveOverrides["@prisma/engines"],`../../${queryEngineName}`);else{let atPrismaEnginesPath;try{atPrismaEnginesPath=eval("require.resolve('@prisma/engines')")}catch(e){throw new Error("Unable to resolve Prisma engine paths. This is a bug.")}queryEnginePath=(0,Co.resolve)(atPrismaEnginesPath`../../${queryEngineName}`)}return{queryEngine:{type:queryEngineType,path:queryEnginePath}}}function guessPrismaClientPath({resolveOverrides}){let prismaClientPath=resolveOverrides["@prisma/client"]||eval("require.resolve('@prisma/client')");return(0,Co.resolve)(prismaClientPath,"../")}});pTe("5COlq",function(e,r){vq(e.exports,"prismaEngineName",()=>n);async function n(i,a){let o=await Gr(),u=o==="windows"?".exe":"";if(a==="library")return $a(o,"fs");if(a==="binary")return`${i}-${o}${u}`;throw new Error(`Unknown engine type: ${a}`)}});function VCt(e){return{models:gq(e.models),enums:gq(e.enums),types:gq(e.types)}}function gq(e){let r={};for(let{name:n,...i}of e)r[n]=i;return r}var Gb=(0,cTe.debug)("prisma:studio-pcw"),KCt=/^s*datasources+([^s]+)s*{/m,YCt=/url *= *env("(.*)")/,XCt=/url *= *"(.*)"/;async function JCt({schema:e,schemaPath:r,dmmf:n,datasourceProvider:i,previewFeatures:a,datasources:o,engineType:u,paths:c,directUrl:l,versions:p}){let f=e.match(KCt)?.[1]??"",g=e.match(YCt)?.[1]??null,v=e.match(XCt)?.[1]??null,{getPrismaClient:E,PrismaClientKnownRequestError:x,PrismaClientRustPanicError:D,PrismaClientInitializationError:P,PrismaClientValidationError:A}=require(`${c.prismaClient}/runtime/${u}`),k=e,F=(0,bq.createHash)("sha256").update(
The column `User.stripe_customer_id` does not exist in the current database.
Query:
{
"modelName": "User",
"operation": "findMany",
"args": {
"take": 100,
"skip": 0,
"select": {
"id": true,
"email": true,
"stripeCustomerId": true,
"stripeSubscriptionId": true,
"stripePriceId": true,
"stripeCurrentPeriodEnd": true
}
}
}
Prisma Schema :
const users = await prisma.user.findMany({
take: 100,
skip: 0,
select: {
id: true,
email: true,
stripeCustomerId: true,
stripeSubscriptionId: true,
stripePriceId: true,
stripeCurrentPeriodEnd: true
}
});
Checked Database Schema:
I ran the command d “User” in my PostgreSQL database to verify that the User table includes the columns stripe_customer_id, stripe_subscription_id, stripe_price_id, and stripe_current_period_end.
Ran Prisma Migrate:
I executed npx prisma migrate dev –name sync_with_schema to ensure that any changes in my Prisma schema were applied to the database.
Generated Prisma Client:
I used npx prisma generate to regenerate the Prisma client so that it reflects the latest schema changes.
Checked Environment Variables:
I verified that my DATABASE_URL environment variable is correctly set to point to my PostgreSQL database.
Enabled Debug Logs:
I added DEBUG=”*” to my .env file to enable detailed Prisma debug logs.
What I Expected:
I expected the Prisma client to successfully execute the query without errors, retrieving the specified fields from the User table.
**
What Actually Happened:**
The error persisted, indicating that the column User.stripe_customer_id does not exist in the current database, despite confirming its presence in the schema and database. The query failed to execute as expected, preventing me from retrieving the user data.
M4dM4x_ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.