question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CLI] Custom environment variables don't work in metadata files

See original GitHub issue

I have a remote_schemas.yaml file:

- name: api
  definition:
    url: "{{ API_GRAPHQL_ENDPOINT }}"
    timeout_seconds: 60

based on the docs here: https://hasura.io/blog/moving-from-local-development-staging-production-with-hasura/. I have the `` environment variable set, but the hasura CLI is still not happy:

❯ API_GRAPHQL_ENDPOINT=https://7asdf8.ngrok.io/graphql hasura metadata apply --admin-secret $HASURA_GRAPHQL_ADMIN_SECRET
FATA[0005] failed to apply metadata: cannot apply metadata on the database: [parse-failed] not a valid URI ($[1].remote_schemas[0].definition.url) 

And dropping the quotes

    url: {{ API_GRAPHQL_ENDPOINT }}

doesn’t work either:

❯ API_GRAPHQL_ENDPOINT=https://7asdf8.ngrok.io/graphql hasura metadata apply --admin-secret $HASURA_GRAPHQL_ADMIN_SECRET
FATA[0004] failed to apply metadata: cannot apply metadata on the database: yaml: invalid map key: map[interface {}]interface {}{"API_GRAPHQL_ENDPOINT":interface {}(nil)} 

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
lughinocommented, Nov 25, 2020

This is a very important feature for us as well. Any ETA for enabling it?

2reactions
OllyDScommented, Dec 21, 2021

I’ve run into this issue - is there a solution?

In the databases.yaml file I need to have a dynamic url so would like to use the following:

database_url:
    from_env: HASURA_GRAPHQL_DATABASE_URL

But I get the following error Inconsistent object: environment variable 'HASURA_GRAPHQL_DATABASE_URL' not set. It’s unclear how this should be set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment and Metadata — Singularity container 3.6 ...
Environment and Metadata . Environment variables are values you can set in a session, which can be used to influence the behavior of...
Read more >
Build environment variables
Identify environment variables available in the build environment, set your own environment variables, and use environment variables during builds.
Read more >
Setting and getting Windows environment variables from ...
To make the environment variable accessible globally you need to set it in the registry. As you've realised by just using: set NEWVAR=SOMETHING....
Read more >
Environment variables in Compose
For versions older than v1.28 , it might have trouble resolving .env file with --file or COMPOSE_FILE . To work around it, it...
Read more >
Environment Variables | Salesforce CLI Setup Guide
Set to true to test string replacement without actually deploying files to the org. Instead, run force:source:convert to convert the files to metadata...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found