sergiodxa / remix-auth

Simple Authentication for Remix
https://sergiodxa.github.io/remix-auth/
MIT License
2k stars 110 forks source link

ReferenceError: request is not defined #248

Closed willin closed 1 year ago

willin commented 1 year ago

Describe the bug

I forked remix-auth-github to build up another one.

when i try to debug, throw a strange error:

Your worker created multiple branches of a single stream (for instance, by calling `response.clone()` or `request.clone()`) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, `new Response(response.body, response)`, `new Request(request)`, etc)
http://localhost:8788/auth/afdian

Trace: ReferenceError: request is not defined
    at action (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:19240:64)
    at callRouteActionRR (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:3403:22)
    at commonRoute.action (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:3491:47)
    at runHandler (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:2495:106)
    at callLoaderOrAction (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:2532:22)
    at submit (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:2143:31)
    at queryImpl (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:2112:22)
    at Object.queryRoute (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:2094:24)
    at handleDataRequestRR (file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:3541:40)
    at file:///private/var/folders/td/zr87rwn546n4q0y3zddn95zw0000gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:3691:32 {
  stack: ReferenceError: request is not defined
    at acti…gn/T/tmp-80305-8k9grXVF8zYS/yi01vxpos4.js:3691:32,
  message: request is not defined
}
    at logConsoleMessage (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:127749:25)
    at WebSocket2.<anonymous> (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:127462:13)
    at callListener (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:107228:18)
    at WebSocket2.onMessage (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:107163:13)
    at WebSocket2.emit (node:events:526:35)
    at Receiver2.receiverOnMessage (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:108231:24)
    at Receiver2.emit (node:events:514:28)
    at Receiver2.dataMessage (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:106513:18)
    at Receiver2.getData (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_modules/wrangler/wrangler-dist/cli.js:106442:21)
    at Receiver2.startLoop (/Users/v0/Projects/willin/remix-auth-afdian/documents/node_modules/.pnpm/wrangler@3.10.1/node_mo

Your worker created multiple branches of a single stream (for instance, by calling `response.clone()` or `request.clone()`) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, `new Response(response.body, response)`, `new Request(request)`, etc).
Your worker created multiple branches of a single stream (for instance, by calling `response.clone()` or `request.clone()`) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, `new Response(response.body, response)`, `new Request(request)`, etc)
[mf:inf] POST /auth/afdian 204 No Content (28ms)

Your Example Website or App

https://github.com/willin/remix-auth-afdian/blob/main/documents/app/routes/auth.afdian.tsx#L16

Steps to Reproduce the Bug or Issue

I have no idea how to debug, the error info is weird

Expected behavior

redirect to oauth login

Screenshots or Videos

No response

Platform

Additional context

No response

willin commented 1 year ago

i changed it to node runtime...