TypeError: outputType.fields is not iterable
See original GitHub issueBug description
I am prisma with postgresql with below schema
Debugged this error a little bit inside compile @prisma/client code and found this (this is a computer generated code though)
In selectionToFields(dmmf, selection, schemaField, path7, context3)
function, we have this line of code inside reduce
method on Object.entries(selection)
const field = outputType.fieldMap ? outputType.fieldMap[name] : outputType.fields.find((f) => f.name === name);
after console.log
, we get this
{
name: 'createOneID',
args: [
{
name: 'data',
isRequired: true,
isNullable: false,
inputTypes: [Array]
}
],
isNullable: false,
outputType: {
type: 'ID',
namespace: 'model',
location: 'outputObjectTypes',
isList: false
}
}
If you look, outputType.type is a string but in other cases it is an object
How to reproduce
- Copy my schema from above
- Initialize postgresql database
- run above create query with required params
Expected behavior
Should create the entity in database
Prisma information
// Add your schema.prisma
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model ArweaveTx {
id String @id @default(uuid())
txId String
txCommitment String
ID ID?
}
model ID {
id String @id
identifier String
provider String
default Json
others Json[]
arweaveTxId String
arweaveTx ArweaveTx @relation(fields: [arweaveTxId], references: [id])
@@unique([arweaveTxId])
}
// Add your code using Prisma Client
export const storeId = async (id: Prisma.IDCreateInput) => {
console.log(id)
const data = await prisma.iD.create({
data: id
})
return data
}
Environment & setup
- OS: Ubuntu LTS
- Database: PostgreSQL
- Node.js version: v16.17.0
Prisma Version
prisma : 4.3.1
@prisma/client : 4.3.1
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Format Wasm : @prisma/prisma-fmt-wasm 4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b
Default Engines Hash : c875e43600dfe042452e0b868f7a48b817b9640b
Studio : 0.473.0
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
TypeError: 'x' is not iterable - JavaScript - MDN Web Docs
The JavaScript exception "is not iterable" occurs when the value which is given as the right-hand side of for...of , as argument of...
Read more >Field output object not iterable - python - Stack Overflow
I get the following error as "Type error Field output object is not iterable". Aravind from odbAccess import * from textRepr import *...
Read more >[BUG] Process exited due to TypeError: log is not iterable
I provided the script that I'm using for the custom selector in case that error could be related to the custom selector. I've...
Read more >How to Fix TypeError in Python: NoneType Object Is Not Iterable
The Python TypeError: NoneType Object Is Not Iterable is an exception that occurs when trying to iterate over a None value. Learn how...
Read more >Intermediate python - SlideShare
Python Tips, Release 0.1 • Iterator • Iteration All of these parts are linked to ... in <module> # TypeError: 'int' object is...
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
oh, my bad, yes i was referring to table name, sorry, it just slept out of my mind
Yes, it failed with database name
ID
and not when I changed it toObjId