New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update and read issues with @prisma/adapter-planetscale
#21592
Comments
Please correct me if I'm doing something stupid, I know this looks very hilarious. |
I'll try my best to create a standalone repro repo yeah |
Can confirm that this happens only when driver adapters are used to form connections |
// Import required dependencies
import { PrismaClient } from '@prisma/client';
const client = new PrismaClient();
console.log(await client.guild.update({
where: { guildId: '801050779107590144' },
data: { locale: 'FR' },
})); // Data updates and comes as expected The code above works as expected. // Import required dependencies
import { connect } from '@planetscale/database';
import { PrismaPlanetScale } from '@prisma/adapter-planetscale';
import { PrismaClient } from '@prisma/client';
import { fetch as undiciFetch } from 'undici';
// Initialize Prisma Client with the PlanetScale serverless database driver
const connection = connect({ url: 'mysql://agdynvln2cbiimhkmfrl:pscale_pw*********************@aws.connect.psdb.cloud/test?sslaccept=strict', fetch: undiciFetch });
const adapter = new PrismaPlanetScale(connection);
const client = new PrismaClient({ adapter });
console.log(await client.guild.update({
where: { guildId: '801050779107590144' },
data: { locale: 'FR' },
})); // null |
@prisma/adapter-planetscale
driver adapter
@prisma/adapter-planetscale
driver adapter@prisma/adapter-planetscale
driver adapter issues
the read issue I mentioned earlier can also be caused by this (?) |
@prisma/adapter-planetscale
driver adapter issuesupdate()
does not work with @prisma/adapter-planetscale
update()
does not work with @prisma/adapter-planetscale
update()
/upsert()
does not work with @prisma/adapter-planetscale
I updated the issue title @Murtatrxx so it can help us understand what is going wrong for you. Does it match what you are reporting now? |
Yes, it does, at least for now if I find more issues related to this, I'll try to update it accordingly |
After some more testing, the read issue I mentioned previously is also caused by this driverAdapter, let me also introduce that; // Import required dependencies
import { connect } from '@planetscale/database';
import { PrismaPlanetScale } from '@prisma/adapter-planetscale';
import { PrismaClient } from '@prisma/client';
import { fetch as undiciFetch } from 'undici';
// Initialize Prisma Client with the PlanetScale serverless database driver
const connection = connect({ url: 'mysql://************@aws.connect.psdb.cloud/test?sslaccept=strict', fetch: undiciFetch });
const adapter = new PrismaPlanetScale(connection);
const client = new PrismaClient({ adapter });
console.log(await client.guild.findFirst());
{
guildId: '8', // The actual data is 801050779107590144
locale: 'FR',
isPremiumActive: false,
} // Whereas this produces expected results
import { PrismaClient } from '@prisma/client';
const client = new PrismaClient();
console.log(await client.guild.findFirst());
{
guildId: '801050779107590144', // The actual data
locale: 'FR',
isPremiumActive: false,
} double checked the results by doing a queries to my DB using the built-in console and TablePlus, confirmed DB actually stores correct values. |
update()
/upsert()
does not work with @prisma/adapter-planetscale
@prisma/adapter-planetscale
I would prefer you to open a second issue for this different, second problem. Thank you. |
But it is related to this |
in the adapter, I listed the issues I encountered |
`CHAR` db type does not mean single character. It should be mapped to Text type instead. Fix #21592
@Murtatrxx I can confirm that both problems you are experiencing have the same cause, so no need for second issue. |
`CHAR` db type does not mean single character. It should be mapped to Text type instead. Fix #21592
@Murtatrxx the issue is fixed and will be published as a part of 5.6.0. If you want to verify that fix works for you, you can try snapshot version |
Yea thanks, I'll try that snapshot, and will soon be in touch with you Update: Yes, it's indeed fixed |
Bug description
Prisma is behaving very strangely here.
So I'm trying to update my data in the database, I am doing everything right (AFAIK) but it just doesn't update or upsert any of my data. When I do try {} catch {}, I can't find anything because it doesn't throw any error, when updating or upserting, it just returns undefined or null.
Writes are fine, reads are mostly fine although I'm experiencing some kind of different issue there (I maybe can open another issue for that one) mostly unrelated.
Things I tried are these;
How to reproduce
I'm connecting Prisma through the serverless driver that you guys added support for recently.
Here's my code that makes those problems;
or
Expected behavior
Should update and upsert data without any issues.
Prisma information
// Add your code using Prisma Client
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: