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

Deploy command is not including wrangler.toml file contents #57

Open
1 of 4 tasks
amiranvarov opened this issue Jul 21, 2024 · 7 comments
Open
1 of 4 tasks

Deploy command is not including wrangler.toml file contents #57

amiranvarov opened this issue Jul 21, 2024 · 7 comments

Comments

@amiranvarov
Copy link

Current Behavior

Hey, first of all, great work! It made my getting started experience with cloudflare so much easier!!! Thank you!

second of all, I'm just starting out, i hope i didn't label it as a bug unecessary. If I did so, sorry.

So, let's proceed to the issue. I just installed this awesome plugin, and when i hit the deploy, i get the warning message: "▲ [WARNING] Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml."

I checked the file system, there is indeed wrangler.toml file generated and it has a content of:

name = "test-worker"
compatibility_date = "2024-01-01"
compatibility_flags = ["nodejs_compat"]
main = "src/index.ts"

but for some reason, during the deploy Cloudflare is not receiving those params. Here are some screenshots:
image
image
image

Expected Behavior

we should not see warning message and compatibility_date param should be injected into deployment by reading the local wrangler.toml file

GitHub Repo

No response

Steps to Reproduce

  1. install nx, install this plugin with template Hono and run deploy

Nx Report

❯ nx report

 NX   Report complete - copy this into the issue template

Node   : 20.13.1
OS     : darwin-arm64
yarn   : 1.22.22

nx (global)        : 19.0.4
nx                 : 19.4.2
@nx/js             : 19.5.1
@nx/jest           : 19.4.2
@nx/linter         : 19.4.2
@nx/eslint         : 19.4.2
@nx/workspace      : 19.4.2
@nx/devkit         : 19.4.2
@nx/esbuild        : 19.5.1
@nx/eslint-plugin  : 19.4.2
@nx/express        : 19.4.2
@nx/next           : 19.4.2
@nx/node           : 19.5.1
@nx/playwright     : 19.4.2
@nx/react          : 19.4.2
@nx/rollup         : 19.4.2
@nrwl/tao          : 19.4.2
@nx/vite           : 19.4.2
@nx/web            : 19.4.2
@nx/webpack        : 19.4.2
typescript         : 5.5.2
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/next/plugin
@nx/playwright/plugin
@nx/rollup/plugin
---------------------------------------
Community plugins:
@naxodev/nx-cloudflare : 3.1.1
@nx-extend/react-email : 1.0.2
---------------------------------------
The following packages should match the installed version of nx
  - @nx/[email protected]
  - @nrwl/[email protected]
  - @nx/[email protected]
  - @nrwl/[email protected]
  - @nx/[email protected]
  - @nrwl/[email protected]

To fix this, run `nx migrate [email protected]`

Failure Logs

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@NachoVazquez
Copy link
Contributor

Hey @amiranvarov, thanks for this issue and your kind words. Yep it seems like the path to wrangler is not set correctly I will take a look at this today.

@NachoVazquez
Copy link
Contributor

I'll be documenting my findings over here. It seems the wrangler is being found. If you remove it, you will see an error instead of a warning. I will dig further into why the compatibility_date is not recognized, but this doesn't seem to be an issue with the plugin.

@NachoVazquez
Copy link
Contributor

NachoVazquez commented Jul 21, 2024

My guess right now is that they have an issue with their exported binary, which is what the plugin uses.

The alternative is to invoke Wrangler using npx or similar.

@amiranvarov
Copy link
Author

sir, you are one kind of a legend for such a fast feedback!

Thanks a lot! Let's see, if they will fix the issue in their next binary releases.

"The alternative is to invoke Wrangler using npx or similar." I'm not familiar with NX much, but i have a feeling that it may cause bunch of other issues with module imports. I assume that your plugin does held wrangler to understand the path aliases mentioned in tsconfig, and other stuff that NX uses under the hood to put all pieces (libraries to be precise) together. If i will try to invoke Wrangler by itself, he will tell me that he has no idea what the hell is being imported from where...

But maybe i'm wrong, and it will be way easier.

@NachoVazquez
Copy link
Contributor

Just for context, the plugin works by calling the underlying tool command (wrangler, in this case) inside the context of an Nx executor.

There are a couple of ways of doing that. You can resolve the binary exposed by the library—that's what we do here. You can also call the library using a package manager like pnpm dlx, npx, etc. We will do that for the next builder.

But both are giving me the same result. It is hard to see what's going wrong. When I call Wrangler directly from the app folder, the warning is not there, but it will be shown when using the plugin.

Wrangler had a similar issue in the past with this warning. I'll continue trying stuff. What I can tell is that the wrangler.toml is being read. Beyond the warning you should not have any issues when deploying. I'm using the project and I can assure it is loading the bindings correctly.

@amiranvarov
Copy link
Author

Thank you for detailed explanation mate. As i said:
image

@NachoVazquez
Copy link
Contributor

You're welcome; I will keep this open while I continue investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants