Skip to content

TypeError: Cannot convert argument to a ByteString because the character at index 12 has a value of 1506 which is greater than 255. #758

@moshe5745

Description

@moshe5745

Version

5.26.2

Describe the bug

Getting this error when trying to use translations inside the redirect function:

if (!user) throw redirect(302, `/auth?error=${get(t).auth.need_to_sign_up_first()}`);

When my translation file was small there was no problem.
After it got bigger I got this error.
It is only in the dev server on my local machine.

Guess it's related to transpilation. In production the files are minified so there is no error there.

Any suggestions for how I can solve this?

Reproduction

Get a big translation dictionary and use it in redirect.

Logs

/auth/login/google
TypeError: Cannot convert argument to a ByteString because the character at index 12 has a value of 1506 which is greater than 255.
    at webidl.converters.ByteString (node:internal/deps/undici/undici:1685:17)
    at Object.record<ByteString, ByteString> (node:internal/deps/undici/undici:1594:32)
    at webidl.converters.HeadersInit (node:internal/deps/undici/undici:2126:67)
    at Object.ResponseInit (node:internal/deps/undici/undici:1650:21)
    at new _Response (node:internal/deps/undici/undici:4664:34)
    at Module.render_endpoint (/Users/moshe_ya/dev/voice-ops/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js:67:11)
    at async resolve (/Users/moshe_ya/dev/voice-ops/node_modules/@sveltejs/kit/src/runtime/server/respond.js:420:17)
    at async google_calendar (/Users/moshe_ya/dev/voice-ops/src/hooks/calendar.ts:8:11)
    at async i18n (/Users/moshe_ya/dev/voice-ops/src/hooks/i18n.ts:14:10)
    at async check_caller (/Users/moshe_ya/dev/voice-ops/src/hooks/check_caller.ts:6:11)

Config

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions