Blitz: Error "Failed to execute 'btoa'" occur when setting multibyte string to session.create

Created on 12 Nov 2020  路  1Comment  路  Source: blitz-js/blitz

What is the problem?

setting string containing multi-byte characters (e.g. Japanese) as a session.create argument will result in the following message: "Error Failed to execute 'btoa': The string to be encoded contains characters outside of the Latin1 range." error occurs.

Steps to Reproduce

  1. run blitz new xxxxx
  2. modify the session.create in the auth module to include a multi-byte string.
  3. following error occurs when signup or login
 Error  Failed to execute 'btoa': The string to be encoded contains characters outside of the Latin1 range.

Versions

macOS Catalina | darwin-x64 | Node: v12.18.0

blitz: 0.25.0 (local)

  Package manager: yarn 
  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 401.34 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.18.0 - ~/.nodebrew/current/bin/node
    Yarn: 1.22.10 - ~/.nodebrew/current/bin/yarn
    npm: 6.14.4 - ~/.nodebrew/current/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    @prisma/cli: 2.11.0 => 2.11.0 
    @prisma/client: 2.11.0 => 2.11.0 
    blitz: 0.25.0 => 0.25.0 
    react: 0.0.0-experimental-4ead6b530 => 0.0.0-experimental-4ead6b530 
    react-dom: 0.0.0-experimental-4ead6b530 => 0.0.0-experimental-4ead6b530 
    typescript: 4.0.5 => 4.0.5 
kinbug scopserver statudone

Most helpful comment

Thanks for raising this issue. I believe the issue is at the btoa call sites in https://github.com/blitz-js/blitz/blob/canary/packages/server/src/supertokens.ts

We're using the https://www.npmjs.com/package/b64-lite library so the docs should be useful.

>All comments

Thanks for raising this issue. I believe the issue is at the btoa call sites in https://github.com/blitz-js/blitz/blob/canary/packages/server/src/supertokens.ts

We're using the https://www.npmjs.com/package/b64-lite library so the docs should be useful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronfulkerson picture aaronfulkerson  路  3Comments

markhaehnel picture markhaehnel  路  3Comments

SharadKumar picture SharadKumar  路  3Comments

flybayer picture flybayer  路  4Comments

netheril96 picture netheril96  路  4Comments