FrontendMasters / fullstack-graphql

370 stars 913 forks source link

Error: GraphQL error: Int cannot represent non 32-bit signed integer value: 1672250526945 #59

Open webuniverseio opened 1 year ago

webuniverseio commented 1 year ago

Running following mutation from https://frontendmasters.com/courses/client-graphql-react/querying-mutations-demo/ image results in following error Error: GraphQL error: Int cannot represent non 32-bit signed integer value: 1672250526945 image

It looks like graphql server implementation is using Int type instead of Date https://stackoverflow.com/questions/44982279/graphql-large-integer-error-int-cannot-represent-non-32-bit-signed-integer-valu

webuniverseio commented 1 year ago

For a hacky fix so I can proceed for now I updated following line in pet.js, but I'm sure we can use a better format for dates

const newPet = {id: nanoid(), createdAt: Math.round(Date.now() / 10000), ...pet}

⚠️ use at your own risk ;) ⚠️