Open james-ff opened 4 years ago
Changed app.ts to this (and a few other changes in Apollo) seemed to fix the issue, not entirely sure why:
import { use, server } from 'nexus'
import { prisma } from 'nexus-plugin-prisma'
import cors from 'cors'
use(prisma({ features: { crud: true }, paginationStrategy: 'prisma' }))
server.express.use(cors())
Seemed to be down to cors not being configured, can we get cors support built in?
For built in cors support please +1 https://github.com/graphql-nexus/nexus/issues/380
Nexus Report
Screenshot
Description
API setup (with schema.queryType and basic crud definitions added):
Nexus crud Queries run in GraphiQL or other clients works as expected.
However when called via a Next.js + ApolloClient SPA locally, nexus gives the error:
But in the network inspector: the requesy.body query field does appear to be present:
And the ApolloClient responds with the following, as it doesn't get a json response from the 400:
It's not clear to me if this is a nexus or an apollo issue, any clarificaiton or insight would be helpful!
Many Thanks,
James.
Repro
Follow nexus + prisma, and next.js + apollo, setup guides: https://www.nexusjs.org/#/plugins/prisma https://github.com/vercel/next.js/tree/canary/examples/with-typescript-graphql