remix icon indicating copy to clipboard operation
remix copied to clipboard

Miniflare crashes blaming a character in the compiled files

Open twosaturdayscode opened this issue 2 years ago • 4 comments

What version of Remix are you using?

1.7.2

Steps to Reproduce

It can be reproduced with a basic install selecting cloudflare-pages as inital template. Then when the page reloads many times due to saved changes in vscode some times it get stucked on reload loops and the error appears in the console.

Expected Behavior

Not crashing due to this strange behaviour

Actual Behavior

dev server stops while throwing this error in the console. It happens when I make changes and save relatively fast.

ReferenceError: p is not defined
    at C:\Users\alisb\AppData\Local\Temp\tmp-25668-uK9Vvp9CD490\zt9o5qrl408.js:15071:1      
    at SourceTextModule.evaluate (node:internal/vm/module:226:23)
    at VMScriptRunner.runAsModule (C:\Users\alisb\Desktop\ummahtoys\node_modules\@miniflare\
runner-vm\src\index.ts:38:18)
    at VMScriptRunner.run (C:\Users\alisb\Desktop\ummahtoys\node_modules\@miniflare\runner-v
m\src\index.ts:82:17)
    at Miniflare.#reload (C:\Users\alisb\Desktop\ummahtoys\node_modules\@miniflare\core\src\
index.ts:775:13)
    at Miniflare.getPlugins (C:\Users\alisb\Desktop\ummahtoys\node_modules\@miniflare\core\s
rc\index.ts:1017:5)
    at createServer (C:\Users\alisb\Desktop\ummahtoys\node_modules\@miniflare\http-server\sr
c\index.ts:369:19)
X [ERROR] Miniflare process exited with code 1

When inspecting the culprit file, I see this: image

These are my package.json commands:

"scripts": {
    "build": "run-s \"build:*\"",
    "build:css": "npm run generate:css -- --minify",
    "build:remix": "remix build",
    "dev": "remix build && run-p \"dev:*\"",
    "dev:css": "npm run generate:css -- --watch",
    "dev:remix": "remix watch",
    "dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev ./public",
    "generate:css": "npx tailwindcss -i ./styles/index.css -o ./app/tailwind.css",
    "start": "cross-env NODE_ENV=production npm run dev:wrangler"

To resume my work I have to exit the current process ctrl + c then redo yarn dev

twosaturdayscode avatar Oct 13 '22 11:10 twosaturdayscode

I can confirm the exact same behaviour. I have recently started with a new project in Remix, first one. And I went with Cloudflare pages adapter and haven't tried any other adapter yet.

@twosaturdayscode Please let me know if you find a consistent way to reproduce the bug. I find it difficult to dig into any source code or make any investigation myself since it happens very randomly for me so far.

johnsoukka avatar Nov 08 '22 19:11 johnsoukka

Hello @johnolofsson I don't know if it really fixed it, but the error didn't happen since I've installed wrangler globally.

npm i -g wrangler

But I didn't report it here right away because it's weird, maybe the issue didn't present itself because I'm not working much on the project. Can you try and report it here?

Since I am already here, it's worthy noting that not many times happened that the leaked foreign characters were: ap Suggesting that maybe the leaked word is app. If you inspect the code that generates that file there is actually the word 'app' in the scope.

twosaturdayscode avatar Nov 09 '22 16:11 twosaturdayscode

I've been working a week or so with wrangler globally installed. Still getting the issue from time to time. First I thought it was less frequent but now it pops up more often. It is difficult to tell if it is some pattern I do in my workflow that triggers it more often.

johnsoukka avatar Nov 25 '22 19:11 johnsoukka

@twosaturdayscode is this still happening with latest Remix version?

machour avatar Jan 22 '23 14:01 machour

Hi @machour honestly I didn't go further with that project, I think that you can close it for now

twosaturdayscode avatar Jan 30 '23 09:01 twosaturdayscode