Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

environment variables not working #643

Open
gigamesh opened this issue Apr 13, 2024 · 2 comments
Open

environment variables not working #643

gigamesh opened this issue Apr 13, 2024 · 2 comments

Comments

@gigamesh
Copy link

If I follow the instructions in the readme and specify an env var like this in .graphclientrc.yml:

sources:
  - name: farther
    handler:
      graphql:
        endpoint: https://api.studio.thegraph.com/query/{env.SUBGRAPH}/version/latest

and then start the process with the following script: SUBGRAPH=<subgraph-id> graphclient build

...the variable doesn't get injected. Does anyone know why?

@gigamesh gigamesh changed the title build time environment variables not working environment variables not working Apr 13, 2024
@gigamesh
Copy link
Author

Unless I'm misunderstanding something, thegraphclient build process has a bug. If I look at the generated code, I see:

...
    config: {
      endpoint: "https://api.studio.thegraph.com/query/{env.SUBGRAPH}/version/latest",
    },
...

If I change it to this, it works:

...
    config: {
      endpoint: `https://api.studio.thegraph.com/query/${process.env.SUBGRAPH}/version/latest`,
    },
...

@gigamesh
Copy link
Author

for anyone else who lands here with the same problem, it works if you make .graphclientrc a javascript file, described here:

ardatan/graphql-mesh#5442 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant