Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Wrangler executes from the wrong directory when package.json higher than wrangler.toml #5481

Open
GregBrimble opened this issue Apr 2, 2024 · 3 comments
Labels
bug Something that isn't working

Comments

@GregBrimble
Copy link
Member

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

3.43.0

What version of Node are you using?

20.12.0

What operating system and version are you using?

macOS

Describe the Bug

- package.json
- packageA
  - package.json
  - serviceA
    - wrangler.toml
    - src
      - index.ts

Running wrangler dev in packageA/serviceA will result in Wrangler not picking up packageA/serviceA/wrangler.toml (so it'll error with ✘ [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. `wrangler dev path/to/script`) or the `main` config field.

Instead, it thinks its running in packageA. This can be proven by running wrangler dev -c serviceA/wrangler.toml (and it correctly picking up the config).

Wrangler shouldn't hoist itself to the nearest package.json (esp. now that we support Python Workers). It should maybe hoist itself to the nearest wrangler.toml. I don't really have strong opinions on that: I personally always run Wrangler in the same dir as wrangler.toml.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@GregBrimble GregBrimble added the bug Something that isn't working label Apr 2, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Apr 2, 2024
@GregBrimble
Copy link
Member Author

Possibly an npx issue?

@saturnonearth
Copy link

I am experiencing the same issue when trying to use the new monorepo features with the wrangler.toml support. It only seems to look for a wrangler.toml file inside the root directory of the git repo (even if the root directory is changed manually in cloudflare pages settings).

This does not work because if I have multiple projects in a monorepo, I would want my wrangler.toml inside the project/app folder and to only apply to that specific app, not the entire git repo. hopefully that makes sense?

@andyjessop andyjessop moved this from Untriaged to Backlog in workers-sdk Jun 24, 2024
@geelen
Copy link
Contributor

geelen commented Nov 12, 2024

FWIW, I just hit this when running pnpm wrangler ... in a subdirectory. Thankfully, npx wrangler ... in the same place works fine, so I've switched to using that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Backlog
Development

No branches or pull requests

3 participants