[ ] 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
Make sure to fork this template and run yarn generate in the terminal.
Please make sure the Codegen and plugins version under package.json matches yours.
[ ] 2. A failing test has been provided
[ ] 3. A local solution has been provided
[ ] 4. A pull request is pending review
Describe the bug
When using environment variables in a configuration file, the environment is not loaded from a '.env` file in the root directory.
If present, the defaults are used, if not, the operation fails.
To Reproduce
Steps to reproduce the behavior:
Create a config file that uses environment variables to specify endpoint or header values.
I was originally using .graphqlrc.yaml with templated strings as documented here.
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
When using environment variables in a configuration file, the environment is not loaded from a '.env` file in the root directory. If present, the defaults are used, if not, the operation fails.
To Reproduce Steps to reproduce the behavior:
Create a config file that uses environment variables to specify endpoint or header values. I was originally using
.graphqlrc.yaml
with templated strings as documented here.Generating code using graphql codegen and type completion with the vscode graphql extension both fail. The LSP produces the following error message:
The environment variable(s) are set in a
.env
file in the root directory.Expected behavior Environment variables should be loaded and the endpoint accessible.
Environment:
Additional context
I was able to workaround this issue by using a
.graphqlrc.js
file instead, and loading dotenv myself: