Error: Failed to convert rust `String` into napi `string`
See original GitHub issueBug description
I’m trying to query a big amount of data that fails, because of some unknown error.
I was only able to find the issue #13192 to be related on this matter.
Full error message:
"stack": "Error: Failed to convert rust `String` into napi `string`
at RequestHandler.request (/app/node_modules/@prisma/client/runtime/index.js:49022:15)
at async /app/build/services/data.service.js:8:20
at async PrismaClient._request (/app/node_modules/@prisma/client/runtime/index.js:49919:18)
at async getData (/app/build/services/data.service.js:16:25)
at async basicStatisticsController (/app/build/controllers/statistics/index.js:16:48)"
How to reproduce
I’m not exactly sure, the error occurs only when I’m querying data that is huge in size, aka somewhere between ~500 MB
Expected behavior
No response
Prisma information
query looks like this:
await prisma.table.findMany({
where: {
dateTime: {
gte: date.start,
lte: date.end,
},
},
});
// Same error when using the queryRaw like this:
await prisma.$queryRaw`
SELECT * FROM "Table"
WHERE "dateTime" BETWEEN ${date.start} AND ${date.end}
`;
Environment & setup
- OS: Windows/Linux
- Database: PostgreSQL
- Node.js version: 16.3
- DB Hosted on: AWS Aurora
Prisma Version
Happens on 3.15.2 as well as 3.14
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:26 (7 by maintainers)
Top Results From Across the Web
string.rs - source - SWC
... "Failed to convert rust `String` into napi `string`" )?; Ok(ptr) } } impl ... env, napi_val, "Failed to convert napi `{}` into...
Read more >I am getting and error Failed to convert rust String into na | Orm-help ...
I am getting and error Failed to convert rust String into napi string Seems ... It happens with same query but only when...
Read more >Error in napi - Rust - Docs.rs
Represent `JsError`. Return this Error in `js_function`, napi-rs will throw it as `JsError` for you. If you want throw it as `TypeError` or...
Read more >How to convert a String into a &'static str - rust - Stack Overflow
Sometime, the original string doesn't live enough, like in a match {...} block. That will lead to a 's' does not live long...
Read more >napi – NAPI-RS
You can use the ClassInstance as Object on the Rust side and manipulate it. ... #[napi] impl JsRepo { #[napi(constructor)] pub fn new(dir:...
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 FreeTop 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
Top GitHub Comments
Alright, i coded a reproduction example. You can find it at https://github.com/Quesstor/prisma-error
I had to make a few test to boil the problem down. The JSON contains a very long string property (>500kb) and you have to select a certain amount of rows (in my case it worked with 1066 rows and breaks with the 1067th one).
You can run the example by cloning the repo and simply run
docker compose up
. The docker compose includes the postgres DB and the example app.There’s a hard-coded string size limit in the V8 engine (JS engine that Node.js relies on). My thoughts are it might be related to that. It’s somewhere between 256 MB - 1 GB. I don’t know exactly.
This stack overflow issue might be useful