Skip to content

Pass HTTP headers on websocket subscription (AppSync, Subscriptions) #853

@0xdevalias

Description

@0xdevalias

This issue pertains to the following package(s):

  • GraphQL Playground - Electron App
  • GraphQL Playground HTML
  • GraphQL Playground
  • GraphQL Playground Express Middleware
  • GraphQL Playground Hapi Middleware
  • GraphQL Playground Koa Middleware
  • GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

macOS Mojave 10.14

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

1.7.0

What is the expected behavior?

When I have an AWS AppSync GraphQL API protected by an API_KEY (set in the x-api-key http header), the subscription should connect to the websocket properly.

What is the actual behavior?

An error is received, being unable to connect:

{
  "error": "Could not connect to websocket endpoint wss://REDACTED.appsync-api.ap-southeast-2.amazonaws.com/graphql. Please check if the endpoint url is correct."
}

I believe this is occurring because the API key isn't sent, and thus it receives a 401 unauthorized response.

What steps may we take to reproduce the behavior?

Create an AWS AppSync GraphQL API protected with an API_KEY and try and subscribe to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions