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

Enabling @graphql-yoga/plugin-sofa plugin breaks GraphQL operations #3112

Open
rhino88 opened this issue Nov 22, 2023 · 3 comments
Open

Enabling @graphql-yoga/plugin-sofa plugin breaks GraphQL operations #3112

rhino88 opened this issue Nov 22, 2023 · 3 comments
Labels

Comments

@rhino88
Copy link
Contributor

rhino88 commented Nov 22, 2023

Describe the bug

After adding the sofa plugin according to the docs (removed title/version to avoid typescript issue) graphql operations are no longer working.

const yoga = createYoga({
  graphiql: {
    defaultQuery,
  },
  schema,
  plugins: [
    useSofa({
      basePath: "/rest",
      swaggerUI: {
        endpoint: "/swagger",
      },
    }),
  ],
});

Before adding useSofa as a plugin any GraphQL query from the graphiql interface is executed as expected:
image

After adding useSofa as a plugin any GraphQL query from the graphiql interface results in an error:
image

Your Example Website or App

https://codesandbox.io/p/devbox/fervent-cray-67rsd5?file=%2Fsrc%2Fmain.ts%3A22%2C1-35%2C4

Steps to Reproduce the Bug or Issue

  1. Go to reproduction
    2 Execute any valid GraphQL Query

Expected behavior

Expecting the swagger UI to render at the appropriate route, and for GraphQL operations to continue functioning as normal.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • NodeJS: 20.10.0
  • @graphql-yoga/plugin-sofa: 3.0.0
  • graphql 16.6.0
  • graphql-yoga: 5.0.0

Additional context

No response

@rhino88 rhino88 changed the title @graphql-yoga/plugin-yoga - unable to execute GraphQL playground query or access /swagger following docs Enabling @graphql-yoga/plugin-yoga plugin breaks all GraphQL operations, and the swagger UI is inaccessible (too many redirects) Nov 22, 2023
@rhino88 rhino88 changed the title Enabling @graphql-yoga/plugin-yoga plugin breaks all GraphQL operations, and the swagger UI is inaccessible (too many redirects) Enabling @graphql-yoga/plugin-sofa plugin breaks all GraphQL operations, and the swagger UI is inaccessible (too many redirects) Nov 23, 2023
@rhino88 rhino88 changed the title Enabling @graphql-yoga/plugin-sofa plugin breaks all GraphQL operations, and the swagger UI is inaccessible (too many redirects) Enabling @graphql-yoga/plugin-sofa plugin breaks GraphQL operations, and the swagger UI is inaccessible (too many redirects) Nov 23, 2023
@EmrysMyrddin
Copy link
Collaborator

Hi @rhino88 and thank you for the report

Sorry but I'm not adding a lot here but just labeling it according to our new Contribution Guide and issue flow.

It seems already got into stage 1 thanks to your reproduction! Thank you for that!

Now in order to advance to stage 2 we'll need a failing test, would be great if someone could help progress the issues through the stages.

Thank you and sorry that this comment is not a complete solution (yet).

@Hurled4505
Copy link

Hurled4505 commented Dec 5, 2023

@rhino88 you tried to access the swagger using the wrong url.
Since you defined a basePath, the swagger can be found under localhost:4000/rest/swagger instead of just localhost:4000/swagger.
But why the graphql query is not working I don't really know.

@rhino88 rhino88 changed the title Enabling @graphql-yoga/plugin-sofa plugin breaks GraphQL operations, and the swagger UI is inaccessible (too many redirects) Enabling @graphql-yoga/plugin-sofa plugin breaks GraphQL operations Dec 11, 2023
@rhino88
Copy link
Contributor Author

rhino88 commented Dec 18, 2023

Thanks @Hurled4505 , I updated the issue to clarify the details.

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

No branches or pull requests

3 participants