Invalid Codegen Configuration when using environment variable with Nextjs #8646
Answered
by
ashishch-98
ashishch-98
asked this question in
Q&A
-
|
Description I have a Nextjs 13 setup in which I am trying to access the GraphQL schema environment variable from
|
Beta Was this translation helpful? Give feedback.
Answered by
ashishch-98
Dec 16, 2022
Replies: 2 comments 5 replies
-
|
Hi @ashishch-98, To get value from your import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config()
const config: CodegenConfig = {
overwrite: true,
schema: process.env.GRAPHQL_ENDPOINT,
documents: "graphql/queries/**/*.{gql,graphql}",
debug: true,
ignoreNoDocuments: true,
watch: true,
generates: {
"graphql/generated/graphql.tsx": {
plugins: [
"typescript",
"typescript-operations",
"typescript-react-apollo"
]
}
}
};
export default config; |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Renaming |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ashishch-98
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Renaming
.env.localto.envresolved the issue for me.