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

@graphql-mesh/cli Unauthorized Error After Reinstalling Dependencies #10119

Open
adamsmichal opened this issue Aug 21, 2024 · 0 comments
Open

Comments

@adamsmichal
Copy link

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

At the beginning of the month, I created an application using @graphql-mesh/cli version 5.0.2. I used the following command to generate my code, and everything worked fine:

dotenv -e .env -- graphql-codegen --config codegen.yaml

Today, I started working on a very similar project, where I’m also using @graphql-mesh/cli in the exact same way:

dotenv -e .env -- graphql-codegen --config codegen.yaml

However, in this new project, I started receiving the following error:

✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to .hasura/generated.ts
    ✖
      Failed to load schema from (here is my correct link):
      unauthorized
      GraphQLError: unauthorized
      at createGraphQLError (/Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/utils/cjs/errors.js:31:12)
      at /Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/wrap/cjs/introspect.js:12:102
      at Array.map (<anonymous>)
      at getSchemaFromIntrospection (/Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/wrap/cjs/introspect.js:12:58)
      at /Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/wrap/cjs/introspect.js:35:32)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async UrlLoader.load (/Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/url-loader/cjs/index.js:221:29)
      at async /Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/load/cjs/load-typedefs/load-file.js:14:39)
      at async Promise.all (index 5)
      at async loadFile (/Users/adamsmichal/Projects/devticon/backend-rest/node_modules/@graphql-tools/load/cjs/load-typedefs/load-file.js:12:9)
      GraphQL Code Generator supports:
      - ES Modules and CommonJS exports (export as default or named export "schema")
      - Introspection JSON File
      - URL of GraphQL endpoint
      - Multiple files with type definitions (glob expression)
      - String in config file
      Try to use one of above options and run codegen again.
    ◼ Load GraphQL documents
    ◼ Generate

To test, I went back to the working project, deleted node_modules and package-lock.json, and then reinstalled the dependencies. Unfortunately, the same error started appearing in the previously working project as well.

This suggests that the issue might be related to deep dependencies that are now causing authorization issues after a fresh install.

Environment:
• @graphql-mesh/cli version: 5.0.2
• Node.js version: 21.5.0
• npm version: 10.2.4

Your Example Website or App

Private

Steps to Reproduce the Bug or Issue

It's hard for me to write how to reproduce the code because it doesn't work when I do it from scratch

Expected behavior

The code generation should work as it did originally without throwing unauthorized errors.

Screenshots or Videos

No response

Platform

@graphql-mesh/cli version: 5.0.2
Node.js version: 21.5.0
npm version: 10.2.4

Codegen Config File

No response

Additional context

No response

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