P
Prisma•4w ago
sommeeeR

Error: TypeError: Cannot convert undefined or null to object

Im trying to migrate an old project using 6.3.1 to latest version (6.19.0). Its a MySQL project. I want to use the new js libs instead of Rust engine as this is hosted in AWS. However, im running into this error when I run prisma generate: Error: TypeError: Cannot convert undefined or null to object
generator client {
provider = "prisma-client-js"
engineType = "client"
}
// IT WAS THIS
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
}
}
generator client {
provider = "prisma-client-js"
engineType = "client"
}
// IT WAS THIS
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
}
}
No description
No description
15 Replies
Prisma AI Help
Prisma AI Help•4w ago
Ahoy, knowledge seeker! I'm the Prisma AI Help Bot. Do you want a dev's response that might take a hot second, or an AI answer that's ready before your next coffee sip? Either way, your question is important to us.
sommeeeR
sommeeeROP•4w ago
This was with DEBUG=* pnpm prisma generate
No description
Aman
Aman•4w ago
Use this generator ``` generator client { provider = "prisma-client" output = " ./generated" engineType= "client" Then change the import of prisma client from @prisma/client to ./prisma/generated/client
sommeeeR
sommeeeROP•4w ago
@Aman Trying this now 🙂 thanks! @Aman That worked. Is there anyway to use the datasourceUrl with the adapter? This seems to not work aynmore:
new PrismaClient({
adapter: adapter,
log: process.env.NODE_ENV === 'development' ? ['error'] : ['error'],
});
new PrismaClient({
adapter: adapter,
log: process.env.NODE_ENV === 'development' ? ['error'] : ['error'],
});
Aman
Aman•4w ago
How your adapter looks like?
sommeeeR
sommeeeROP•4w ago
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error('DATABASE_URL env var missing');
}
const url = new URL(databaseUrl);

const adapter = new PrismaMariaDb({
host: url.hostname,
user: url.username,
password: url.password,
database: url.pathname.replace(/^\//, ''),
connectionLimit: 5,
});
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error('DATABASE_URL env var missing');
}
const url = new URL(databaseUrl);

const adapter = new PrismaMariaDb({
host: url.hostname,
user: url.username,
password: url.password,
database: url.pathname.replace(/^\//, ''),
connectionLimit: 5,
});
This did the trick actually. TRying to deploy to staging now 🤞 Havent touched this app in a year or so, but its still used by many users
Aman
Aman•4w ago
That's great 😃
sommeeeR
sommeeeROP•4w ago
Need to test thoroughly tho, since its payments there and its a client of mine Hopefully it works! I deploy via SST
Aman
Aman•4w ago
Have you tried alchemy?
sommeeeR
sommeeeROP•4w ago
You think its gonna make AWS Lambdas have less cold start?
Aman
Aman•4w ago
Oh you deploy to aws
sommeeeR
sommeeeROP•4w ago
No what is alchemy
Aman
Aman•4w ago
Cool cool alchemy is for cloudflare mainly similar to sst
sommeeeR
sommeeeROP•4w ago
@Aman Should I add ./generated to .gitignore?
Aman
Aman•4w ago
Yes

Did you find this page helpful?