Skip to content

GraphQL handler: environment variables not working for endpoint for subscriptions/WebSocket calls #5296

Open
@xmlking

Description

@xmlking

environment variables not working with GraphQL Handler endpoint when invoking subscriptions. I have to give real URL.
I even tried to provide subscriptionsEndpoint via environment variables without any luck.
This is preventing us deploying to different environments without hardcoding endpoints...

Queries and Mutations works fine when setting GraphQL endpoint via environment variables.

  - name: mysub
    handler:
      graphql:
        # environment variables not working with graphql subscriptions endpoint
        # endpoint: '{env.MY_SEB_ENDPOINT}'
        endpoint: http://localhost:8080/graphql
        # subscriptionsEndpoint:  ws://localhost:8080/graphql

Error

/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:675
      throw new SyntaxError(`Invalid URL: ${address}`);
            ^
SyntaxError: Invalid URL: {env.MY_SEB_ENDPOINT}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions