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

Facing an Invalid Credentials while running a Mesh Project #4277

Closed
vijayakumarit opened this issue Aug 11, 2022 · 1 comment
Closed

Facing an Invalid Credentials while running a Mesh Project #4277

vijayakumarit opened this issue Aug 11, 2022 · 1 comment

Comments

@vijayakumarit
Copy link

vijayakumarit commented Aug 11, 2022

Hello, @ardatan. My goal is simple. I want to connect my "accessToken" in the TS file with YAML headers. I have already seen some examples available in our repo. I attempted in the same manner, but I received a bad credential error. If I pass the same "accessToken" in the YAML file, it works perfectly. Just give your input if I am doing anything wrong. I'm adding a code snippet FYR.

I am sharing the screenshots.

Screenshot 2022-08-11 at 2 09 20 PM

Screenshot 2022-08-11 at 2 09 30 PM

Screenshot 2022-08-11 at 2 09 41 PM

@Urigo Urigo mentioned this issue Aug 11, 2022
46 tasks
@ardatan
Copy link
Owner

ardatan commented Aug 11, 2022

schemaHeaders are called once during mesh build so before execution to fetch the schema. Apparently there is no context yet so you can only access environment variables using env.. In order to build Mesh artifacts, you should provide an introspection to Mesh. There are 2 options to fix this;

  • If the actual endpoint is behind an auth, you can provide an env var {env.MY_TOKEN} just for build then use artifacts as usual.
  • You can use introspection.
    • For example, it is introspection: https://docs.github.com/public/schema.docs.graphql in this case

I think you got confused because of its missing in the documentation. Sorry for that. We already have this issue to add this information to docs;
#4106

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

2 participants