Skip to content

WebSocket: Router doesn't parse accents from co-processor's context when connecting to subgraph #8781

@reggermont

Description

@reggermont

Describe the bug

Hello ! I have a very specific case that triggers an unexpected error where characters with accent are badly converted:

"message": "HTTP fetch failed from 'module-test': Websocket fetch failed from 'module-test': cannot connect websocket to subgraph: invalid UTF-8 in WebSocket handshake: failed to convert header to a str for header name 'myAccent' with value: \"\\xc3\\xa8\"",

The character è should be a valid UTF-8 character: https://unicodeplus.com/U+00E8

It works well on Query / Mutation (http), but not on Subscription (ws)

To Reproduce

Steps to reproduce the behavior:

  1. In co-processor, return a string with an accent in res.json
res.json({
  context: {
    entries: {
      willTriggerAnError: "è",
    },
  },
});
  1. Configure router to insert header from context
headers:
  all:
    request:
      - insert:
          name: myAccent
          from_context: willTriggerAnError
  1. See error

Expected behavior

No error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions