Getting error deploying to Vercel : `Error: "Query" defined in resolvers, but not in schema`
See original GitHub issueI’m trying to deploy a slightly modified version of the Next.js official graphql-let example and I’m getting this error Error: "Query" defined in resolvers, but not in schema
.
So I’ve looked into lib/schema.ts
and when adding some logs:
import { join } from 'path'
import { makeExecutableSchema } from '@graphql-tools/schema'
import { loadFilesSync } from '@graphql-tools/load-files'
import { mergeTypeDefs } from '@graphql-tools/merge'
import graphQLLetConfig from '../../.graphql-let.yml'
import resolvers from './resolvers'
const loadedFiles = loadFilesSync(join(process.cwd(), graphQLLetConfig.schema))
const typeDefs = mergeTypeDefs(loadedFiles)
console.log(`Loaded files:`);
console.log(loadedFiles);
console.log(`Graphql-let config schema`);
console.log(graphQLLetConfig.schema);
console.log(`Path ${process.cwd()}`);
console.log(`Join: ${join(process.cwd(), graphQLLetConfig.schema)}`)
export const schema = makeExecutableSchema({
typeDefs,
resolvers,
})
I’m getting this:
Loaded files:
[]
Graphql-let config schema
**/*.graphqls
Path /var/task
Join: /var/task/**/*.graphqls
Loaded files seems to be empty. An issue was opened last year https://github.com/piglovesyou/graphql-let/issues/214 regarding this error with SSR config but I’m running a Static config.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Error: Query.Mutation defined in resolvers, but not in schema
I think you are simply missing a curly bracket. const resolvers = { Query:{ hello: () => 'Hello World', notes: () => notes,...
Read more >Deploying with managed federation - Apollo GraphQL Docs
This ensures that resolvers are in place for all operations that are executable against your graph, and operations can't attempt to access fields...
Read more >How to resolve 'X defined in resolvers, but not in schema' with ...
The root cause here is that the babel-plugin-inline-import plugin caches your schema. The resolution is essentially to have BABEL_DISABLE_CACHE=1 in your . env ......
Read more >GraphQL | RedwoodJS Docs
You define your SDLs (schema) in *.sdl.js files, which define what queries and mutations are available, and what fields can be returned; For...
Read more >Why does my Serverless Function work locally but not when ...
It can be frustrating when your code works locally, but not when deployed to ... eyes on your problem, consider starting a Discussion...
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
loadFileSync
requires the files to be present on the Vercel filesystem at runtime. By default Vercel will only include the built files. You need to update your Vercel configuration to tell it to include these files.The other option is not to use loadFileSync and instead use Webpack to load the files at build time. This way they are included in the built output
I would create a new issue for that and include a reproduce-able demo.