Closed jwstevens20 closed 2 years ago
When attempting to execute a query, I get the following response:
{ "errors": [ { "message": "The supplied JWT is invalid or expired." } ] }
When hard-coding in the JWT all works correctly.
The JWT is pulled from the environment variable.
// graphql.config.js module.exports = { projects: { live: { schema: 'http://localhost:8020/graphql', extensions: { endpoints: { default: { url: 'http://localhost:8020/graphql', headers: { Authorization: `${process.env.GRAPHQL_API_TOKEN}` } } } } } } };
# .env GRAPHQL_API_TOKEN='...'
Your issue might be similar to issue #284. @RKings solved it by requiring dotenv and pointing to the projects .env file.
dotenv
.env
// graphql.config.js require('dotenv').config({ path: __dirname + '/.env', });
Thank you @lucagoslar !
Worked perfectly. Thank you, @lucagoslar!!
Actual Behavior
When attempting to execute a query, I get the following response:
When hard-coding in the JWT all works correctly.
Expected Behavior
The JWT is pulled from the environment variable.
Steps to Reproduce the Problem Or Description
Specifications
Logs Of TS Server || GraphQL Language Service