PANIC: 1 -> Query can't return single id on Array field
See original GitHub issueHi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Name | Version |
---|---|
Node | v12.18.3 |
OS | windows |
Prisma Client | 2.9.0 |
Logs
prisma-client {
engineConfig: {
cwd: '<project root>\\prisma',
enableDebugLogs: false,
enableEngineDebugMode: undefined,
datamodelPath: '<project root>\\node_modules\\.prisma\\client\\schema.prisma',
prismaPath: undefined,
engineEndpoint: undefined,
generator: {
name: 'client',
provider: 'prisma-client-js',
output: '<project root>\\node_modules\\@prisma\\client',
binaryTargets: [],
previewFeatures: [],
config: {}
},
showColors: false,
logLevel: undefined,
logQueries: undefined,
flags: [],
clientVersion: '2.9.0',
enableExperimental: [],
useUds: undefined
}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
panic: json: cannot unmarshal array into Go value of type main ...
The application is unmarshalling a JSON array to a struct. Unmarshal to a slice: var data []interface{} err = json.Unmarshal(body, &data).
Read more >selecting an array element, based on subelement value -> jq ...
jq '.DATA | select(.DOMAIN=="domain2")'. I get. jq: error: Cannot index array with string. How do I find/select the desired subelement?
Read more >Retrieving Result Sets - Go database/sql tutorial
We're using db.Query() to send the query to the database. We check the error, as usual. · We defer rows.Close() . · We...
Read more >The way I handled possible null values from database rows in ...
Few weeks ago, I was working on one of the web services of my project, where back-end has been developed using Go and...
Read more >Gomega is a matcher
Eventually can be passed functions that return at least one value. ... Eventually(func(g Gomega) (Widget, error) { ids, err := client.FetchIDs() g.
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
I realize the log above might not be enough information, so here is some context… I upgraded our project recently from prisma v 2.4.1 to 2.9.0. Before the upgrade, I was able to run these query:
After the upgrade, I receive the Panic error posted above. I noticed that if I add a field to sessions or gradeLevels (example below) or if I just ask a single field that’s not the id on sessions or gradeLevels, the query runs without error
The issue seems to be asking for a single id on a nested array field, although some other models with arrays fields can be queried for just the id successfully. Here is the schema for the two objects queried above:
Yes this is still an issue testing in version 2.14.0. I was able to reproduce the error using the basic quickstart starter project (https://www.prisma.io/docs/getting-started/quickstart-typescript) by making these changes:
schema.prisma:
script.ts:
I seeded the db with 3 users and 1 post that had 2 users and ran
npm run dev
Works on version 2.4.1, fails on 2.9.0 and latest 2.14.0Using the starter project, I was able to see a more detailed error:
Hi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Query
Logs
Client Snippet
Schema