executeRaw error: PrismaClientKnownRequestError: Raw query failed. Code: `N/A`. Message: `N/A` when executing successful create queries
See original GitHub issueBug description
If a query that does not return results is ran with db.executeRaw
, it throws the following error:
PrismaClientKnownRequestError: Raw query failed. Code: `N/A`. Message: `N/A`
at PrismaClientFetcher.request (D:\dev\perimetre\export-connect-backend\node_modules\@prisma\client\src\runtime\getPrismaClient.ts:902:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 'P2010',
meta: { code: 'N/A', message: 'N/A' }
}
But even thought I get an exception, the query still runs successfully and the database is modified correctly.
An example of the query that It’s being ran:
CREATE TABLE IF NOT EXISTS `MyTable` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `MyTable.slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
This also happenned when running a select query with queryRaw
and the table did not have any data. I got the error instead of getting an undefined result or an empty array.
How to reproduce
- Make a simple create query like the one in the example above
- Execute it with
db.executeRaw
Expected behavior
The expected behaviour should be that no exception is thrown since the operation worked successfully
Environment & setup
- OS: Windows 10
- Database: Mysql 8
- Prisma version: 2.1.3
- Node.js version: v12.18.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Prisma Client API (Reference)
In this situation, one of the operations succesfully creates the new record but the other operations fail and return a unique key constraint...
Read more >prisma $queryRaw doesn't work with single quotes in the ...
queryRaw()` invocation: Your raw query had an incorrect number of parameters. Expected: `1`, actual: `2`. code: 'P1016', ...
Read more >After upgrading to version3 0 2 I get error for queryRaw Pri
After upgrading to version3.0.2 I get error for queryRaw: PrismaClientKnownRequestError: Invalid `prisma.queryRaw()` invocation: Raw query ...
Read more >Prisma Versions
Interactive transactions allow you to pass an async function into a $transaction , and execute any code you like between the individual Prisma...
Read more >Highlights - FeedsAnywhere
There are no nested queries in the upsert 's create and update options ... The error message will now be more useful (...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
remove quotes inside SQL command, leave just
AND YEAR(date_facture) = ${annee} AND MONTH(date_facture) = ${mois} AND MONTH(date_facture) = ${mois}
Please open a new discussion or bug report @mjpaquet. Thanks.