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

Unable to load GraphQL schema in VS Code Extension #12477

Open
1 task done
ris314 opened this issue Nov 17, 2023 · 1 comment
Open
1 task done

Unable to load GraphQL schema in VS Code Extension #12477

ris314 opened this issue Nov 17, 2023 · 1 comment
Labels
protocol/graphql Issues relating to the GraphQL protocol within Postman vscode

Comments

@ris314
Copy link

ris314 commented Nov 17, 2023

Is there an existing issue for this?

  • I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

When interacting with a GraphQL server using the Postman Visual Code extension, it is not possible to load the schema.

Looking at the console output, {{url}} variable is utilized:
image

I have defined the variable as a global, and in the pre-request script included:

console.log(
    pm.globals.get("url")
);

Now, when I click on the refresh button to pull down the schema, the following is output in the console:
image

Whereas, when I click on the send button to make a query request:
image

Note that I have replicated the same value in the POST url to ensure that both the schema request and query requests are using the same.

It seems that the global {{url}} value is not referenced properly by the schema request.

Steps To Reproduce

  1. In Visual Studio Code, open the Postman extension.
  2. In the Environments section, ensure global url value is defined:
image 4. Select "New HTTP Request" - specify it as "POST" with url as `http://{{url}}/` (This url replicates what schema request uses, so you will need to be able to hit a valid GraphQL server via http) - select "Body" and then check off "GraphQL" image 5. Specify to auto fetch the schema image 6. Refresh the schema 7. Observe error in the Postman console: image

Screenshots or Videos

No response

Operating System

macOS

Postman Version

0.14.3

Postman Platform

Other

User Account Type

Signed In User

Additional Context?

No response

@ris314
Copy link
Author

ris314 commented Nov 17, 2023

From the expectations perspective, my first instinct was that the URL defined for the POST request would be used in the schema request. I.e. the same URL should be utilized for both body requests and schema requests.

Alternatively, it could be worthwhile allowing users to specify the url for the schema request.

Relying on the {{url}} variable seems a bit cryptic and is only going to be picked up by people if they inspect the logs/console.

@DSchau DSchau added protocol/graphql Issues relating to the GraphQL protocol within Postman vscode labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol/graphql Issues relating to the GraphQL protocol within Postman vscode
Projects
None yet
Development

No branches or pull requests

2 participants