I have a Apollo server query that returns an array of movies based on a userIdvalue:
moviesFromUser: async (root, args) => {
const movie = await prisma.movie.findMany({
where: {userId: args.userId},
});
console.log(movie);
return movie;
},
In the sandbox I have a query to fetch the movies based on userId:
query moviesFromUser {
moviesFromUser(userId: 1) {
original_title
}
}
When I run this query I see the movies I've requested in the console log of the Apollo server:
[
{
id: 251,
original_title: 'Dune',
tmdb_id: 2,
poster_path: 'cDbNAY0KM84cxXhmj8f0dLWza3t.jpg',
userId: 1
},
{
id: 252,
original_title: 'Batman',
tmdb_id: 3,
poster_path: 'asdadsdasadsadsdas.jpg',
userId: 1
}
]
But the actual response in the playground is:
"message": "Cannot return null for non-nullable field Movie.original_title."