I can run my Discord bot smoothly on my local machine. However, when I moved the bot to a VDS, I encountered the following two errors LensError: Lens returned a 302 status code twiceThe error details are as follows:
LensError: Lens returned a 302 status code twice at Lens.fetch (file:///home/ubuntu/wrecbot/node_modules/chrome-lens-ocr/src/core.js:146:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async handleImageScan (/home/ubuntu/wrecbot/para.js:10:15) at async Object.execute (/home/ubuntu/wrecbot/commands/utility/paraYatir.js:34:23) at async Client.<anonymous> (/home/ubuntu/wrecbot/index.js:101:3) { code: 302, headers: HeadersList { cookies: null, [Symbol(headers map)]: Map(18) {'content-type' => [Object],'x-frame-options' => [Object],'access-control-allow-origin' => [Object], ... }, [Symbol(headers map sorted)]: null }, body: ''}
This error occurs in the VDS environment, but I do not encounter this issue when running on my local machine. I allow all traffics (no limitation even a potato reach it). How can I resolve the redirection (302) error? ReferenceError: Cannot access 'res' before initialization:
ReferenceError: Cannot access 'res' before initialization at handleImageScan (/home/ubuntu/wrecbot/para.js:11:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.execute (/home/ubuntu/wrecbot/commands/utility/paraYatir.js:34:23) at async Client.<anonymous> (/home/ubuntu/wrecbot/index.js:101:3)
I know that this error is caused by trying to use the res variable before it is defined, so its probably because of lens error.Technologies I Am Using: Node.js version: 20.17.0 (on local machine) and 18.19.1 (on VDS) I am using the chrome-lens-ocr library. I am also using AWS EC2 VDS.What I Have Tried: I recreated the node_modules folder on the VDS (npm install). I allow all ip addresses to reach vds. My Questions: How can I resolve the LensError: 302 status code twice error that I encountered in the VDS environment? Could this be due to a redirection or a VDS configuration issue? What other adjustments should I make in the code to resolve the ReferenceError? Thank you!