Alejandro Sanchez
06/04/2020, 8:21 PMError: Cannot return null for non-nullable field Home.name.
Alejandro Sanchez
06/04/2020, 8:21 PMasync function home(parent, args, context) {
const home = await context.prisma.home({
id: args.id
})
return home
}
Alejandro Sanchez
06/04/2020, 8:22 PMtype Home {
id: ID!
createdAt: DateTime!
description: String!
url: String!
name: String!
location: String!
postedBy: User
}
Alejandro Sanchez
06/04/2020, 8:22 PMAlejandro Sanchez
06/04/2020, 8:26 PMAlejandro Sanchez
06/04/2020, 8:27 PM{
name: 'XXX',
location: 'XXX',
url: '200',
description: 'XXX',
id: 'ckavmr5cs9jps0963eex7xl2d',
createdAt: '2020-05-31T22:22:54.940Z'
}
Error: Cannot return null for non-nullable field Home.name.
at completeValue (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:560:13)
at completeValueCatchingError (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:495:19)
at resolveField (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:435:10)
at executeFields (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:275:18)
at collectAndExecuteSubfields (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:713:10)
at completeObjectValue (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:703:10)
at completeValue (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:591:12)
at completeValue (/Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:557:21)
at /Users/sancheza/Library/Mobile Documents/com~apple~CloudDocs/Projects/homeinroom/server/node_modules/graphql/execution/execute.js:492:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Ethan Pursley
06/04/2020, 8:40 PMname: String!
Alejandro Sanchez
06/04/2020, 8:40 PMEthan Pursley
06/04/2020, 8:41 PM!
means required, so you cannot return a null
for name
when you return that object typeAlejandro Sanchez
06/04/2020, 8:41 PMEthan Pursley
06/04/2020, 8:41 PM''
would workEthan Pursley
06/04/2020, 8:41 PM!
Alejandro Sanchez
06/04/2020, 8:42 PMAlejandro Sanchez
06/04/2020, 8:42 PMyarn prisma generate && yarn prisma deploy --force
Ethan Pursley
06/04/2020, 8:43 PMAlejandro Sanchez
06/04/2020, 8:49 PMEthan Pursley
06/04/2020, 8:51 PMAlejandro Sanchez
06/04/2020, 8:51 PMif (loading) return <div>Fetching</div>;
if (error) return <div>Error</div>;
Alejandro Sanchez
06/04/2020, 8:51 PMEthan Pursley
06/04/2020, 8:51 PMEthan Pursley
06/04/2020, 8:52 PMAlejandro Sanchez
06/04/2020, 8:52 PMEthan Pursley
06/04/2020, 8:53 PMAlejandro Sanchez
06/04/2020, 9:11 PMAlejandro Sanchez
06/04/2020, 9:11 PMAlejandro Sanchez
06/04/2020, 9:11 PMEthan Pursley
06/04/2020, 9:13 PMloading
, refresh
, subscribeToMore
, etcEthan Pursley
06/04/2020, 9:14 PMEthan Pursley
06/04/2020, 9:14 PMEthan Pursley
06/04/2020, 9:14 PMAlejandro Sanchez
06/04/2020, 9:19 PMAlejandro Sanchez
06/04/2020, 9:19 PMEthan Pursley
06/04/2020, 9:20 PM