orange icon indicating copy to clipboard operation
orange copied to clipboard

Unable to setup the repo locally

Open Vaib215 opened this issue 1 year ago • 2 comments

I cloned the repo locally & followed the instructions. After setting up the .dev.vars file, I got this issue on running it in browser:

✘ [ERROR] DOMException {

    code: 5,
    name: 'InvalidCharacterError',
    message: "atob() called with invalid base64-encoded data. (Only whitespace, '+', '/', alphanumeric ASCII, and up to two terminal '=' signs when the input data length is divisible by 4 are allowed.)",
    stack: "InvalidCharacterError: atob() called with invalid base64-encoded data. (Only whitespace, '+', '/', alphanumeric ASCII, and up to two terminal '=' signs when the input data length is divisible by 4 are allowed.)\n" +
      '    at unsign (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/cloudflare/dist/crypto.js:29:42)\n' +
      '    at async decodeCookieValue (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/cookies.js:88:27)\n' +
      '    at async Object.parse (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/cookies.js:60:60)\n' +
      '    at async getSession (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/sessions/cookieStorage.js:32:45)\n' +
      '    at async getUsername (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/app/utils/getUsername.server.ts:31:18)\n' +
      '    at async loader (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/app/root.tsx:36:20)\n' +
      '    at async callRouteLoader (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/data.js:62:16)\n' +
      '    at null.<anonymous> (async file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/.wrangler/tmp/dev-eqryWK/index.js:3128:19)\n' +
      '    at async callLoaderOrAction (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:4832:16)\n' +
      '    at async Promise.all (index 0)'
  }

[wrangler:inf] GET / 500 Internal Server Error (36ms)

I want to play around with cloudflare calls. Is there a way to resolve this problem?

Vaib215 avatar Jun 29 '24 13:06 Vaib215

I managed to run the code by replacing atob with decode from cloudflare's base64url utilities package but then i got this error once i enter my display name

✘ [ERROR] SyntaxError: Invalid character /

      at parse (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/rfc4648/lib/rfc4648.js:48:13)
      at Object.parse (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/rfc4648/lib/rfc4648.js:167:12)
      at decode (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@cfworker/base64url/dist/decode.js:3:47)
      at unsign (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/cloudflare/dist/crypto.js:30:42)
      at async decodeCookieValue (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/cookies.js:88:27)
      at async Object.parse (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/cookies.js:60:60)
      at async getSession (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/sessions/cookieStorage.js:32:45)
      at async getUsername (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/app/utils/getUsername.server.ts:31:18)
      at async loader (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/app/root.tsx:36:20)
      at async callRouteLoader (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/data.js:62:16)

Vaib215 avatar Jun 29 '24 14:06 Vaib215

Also this one sometimes

[wrangler:inf] GET /build/routes/_index-ZF727FQZ.js 200 OK (8ms)

✘ [ERROR] Error: Invariant failed

      at invariant (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/tiny-invariant/dist/esm/tiny-invariant.js:12:11)
      at loader7 (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/app/routes/_index.tsx:16:2)
      at async callRouteLoader (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/server-runtime/dist/esm/data.js:62:16)
      at null.<anonymous> (async file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/.wrangler/tmp/dev-VvfP1x/index.js:3128:19)
      at async callLoaderOrAction (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:4832:16)
      at async Promise.all (index 1)
      at async callDataStrategyImpl (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:4673:17)
      at async callDataStrategy (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:3928:19)
      at async loadRouteData (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:3872:19)
      at async queryImpl (file:///Users/vaib/Documents/codes/webdev/the-abc-live/orange/node_modules/@remix-run/router/router.ts:3631:20)

[wrangler:inf] GET / 500 Internal Server Error (24ms)

Vaib215 avatar Jun 29 '24 14:06 Vaib215

same issue here - clean install, added SFU app id/secret to .dev.vars as well as openai endpoint/token

have also tried upgrading wrangler & other packages, end up getting a warning message where I think wrangler doesn't recognize partykit's Server class as a WorkerEntryPoint

I believe this comes down to browser cookies. possibly from using the demo app & having a stale pre existing cookie on the same __session key?

when I open in incognito browser tab this issue goes away

sadsciencee avatar Feb 18 '25 01:02 sadsciencee

@sadsciencee if you try clearing all site data before loading the page, does it work? If so, are you able to reliably get it back into the bad state? And if so, what are the exact steps you take to get it into that state?

Additionally, your specific browser info (name, version) would be helpful!

third774 avatar Feb 18 '25 18:02 third774

hey @third774 after clearing all cookies from localhost, it works and I'm not able to reproduce unfortunately. tried spinning up a few other projects that run on the same port to see if it was an auth conflict but to no avail. will write back if I run into it again

error was occuring at this line

const session = await getSession(request.headers.get('Cookie'))

in getUsername.server.ts

also tried updating the secret to another string before clearing cookies, same issue

sadsciencee avatar Feb 18 '25 21:02 sadsciencee

Closing this for now, please LMK if this issue persists!

third774 avatar Feb 26 '25 00:02 third774