cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.57k stars 660 forks source link

🐛 BUG: When I run "npx wrangler types --env-interface CloudflareBindings" while using jsx in my entrypoint I get a parse error. #6488

Open yomashishi opened 1 month ago

yomashishi commented 1 month ago

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.71.0 [Wrangler]

What version of Node are you using?

20.14.0

What operating system and version are you using?

WSL Ubuntu 22.04.3 LTS

Describe the Bug

Observed behavior

When I run "npx wrangler types --env-interface CloudflareBindings" while using jsx in my entrypoint I get a parse error.

Expected behavior

Running "npx wrangler types --env-interface CloudflareBindings" for an entrypoint using jsx should not result in a parse error.


Sorry if I missed any notes.

Please provide a link to a minimal reproduction

https://github.com/yomashishi/parse-error-when-wrangler-types-command

Please provide any relevant error logs


--- 2024-08-13T17:12:18.769Z debug
🪵  Writing logs to "/home/xxxxxxxx/.config/.wrangler/logs/wrangler-2024-08-13_17-12-18_518.log"
---

--- 2024-08-13T17:12:18.769Z debug
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:573:18)
    at Object.readFileSync (node:fs:452:35)
    at tryLoadDotEnv (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:157723:72)
    at loadDotEnv (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:157732:12)
    at /home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:203219:20
    at /home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:165954:16
    at maybeAsyncResult (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:164175:44)
    at /home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:165953:14
    at /home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:164162:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}
---

--- 2024-08-13T17:12:18.792Z log

 ⛅️ wrangler 3.71.0
-------------------

---

--- 2024-08-13T17:12:18.794Z debug
No experimental flag store instantiated
---

--- 2024-08-13T17:12:18.794Z debug
Attempted to use flag "JSON_CONFIG_FILE" which has not been instantiated
---

--- 2024-08-13T17:12:18.804Z debug
Failed to load .env file "/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/.dev.vars": Error: ENOENT: no such file or directory, open '/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/.dev.vars'
    at Object.openSync (node:fs:573:18)
    at Object.readFileSync (node:fs:452:35)
    at tryLoadDotEnv (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:157723:72)
    at loadDotEnv (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:157732:12)
    at getVarsForDev (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:199003:18)
    at Object.typesHandler [as handler] (/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/node_modules/wrangler/wrangler-dist/cli.js:199179:19) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/xxxxxxxx/ghq/github.com/yomashishi/parse-error-when-wrangler-types-command/.dev.vars'
}
---

--- 2024-08-13T17:12:18.829Z log

---

--- 2024-08-13T17:12:18.892Z error
✘ [ERROR] Parse error @:21:34

---

--- 2024-08-13T17:12:18.892Z log
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
---

--- 2024-08-13T17:12:31.426Z debug
Sentry: Reporting disabled - would have sent Error: Parse error @:21:34.
---
CarmenPopoviciu commented 1 month ago

@andyjessop probably relevant to your work on wrangler types