-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(templates): update Cloudflare templates to use wrangler
v2
#3160
Conversation
wrangler
v2
@jacob-ebey Is there a reason why |
Thank you for providing a useful template. One suggestion would be. The kv-asset-handler installed from the template seemed to be v0.1.3. https://github.com/cloudflare/kv-asset-handler/releases/tag/v0.2.0 |
@aiji42 Could you please rebase this PR onto latest |
@MichaelDeBoey I have resolved the conflicts! 👍 |
@himorishige |
@aiji42 thanks for putting this together! i just applied your changes manually (updating for anyone else running into issues and searching for answers, i originally tried to create a new remix project using
replacing the contents of name = "remix-cloudflare-workers"
compatibility_date = "2022-05-11"
account_id = ""
workers_dev = true
main = "./build/index.js"
[site]
bucket = "./public"
[build]
command = "npm run build" |
Thanks for your feedback. As you indicated, it may not necessarily need to be updated as a template. We will withdraw this proposal. |
Wrangler 2 also includes miniflare, so should this change also remove the explicit miniflare dependency from cloudflare-workers and change the |
Except, I just found this in the Cloudflare Discord:
Given that Remix on Workers relies on being a worker site, shouldn't we stick with wrangler 1? |
I just tested this - I created a new Workers app with |
I arrived at these changes independently of seeing this PR since the CF docs now say to use wrangler2 from NPM. Most things seem to be working except for static asset serving. I can see the assets get uploaded, stored in a KV namespace, and be requested by a client, but something either in I tried messing with I wonder if this might be related to the "you can no longer create them" mentioned above, as this is a new worker/site, and as far as I can tell everything should be working. Using pages is also sadly a non-starter at the moment as pages does not support R2 bindings yet and the (CF) docs poorly explain the new manual upload deployment method (as this project isn't in github/gitlab). ETA: It looks like serving favicon works, so it may be some deeper issue. It is also worth noting that I had to manually resolve miniflare (when using yarn at least) as different versions were being installed to satisfy the direct dev dependency vs the dependency through wrangler, which was causing weird issues in dev (failing to parse incoming requests).
|
I got it working with the above instructions on wrangler 2. The images are working fine for me as I import them in code though not served statically. |
Just a question. Does the |
What is left to do here? Need a hand with anything? Wrangler 2 is the official way forward and I'm seeing a lot of people in the community confused when generating a new app. |
@aiji42 Could you please rebase your branch on latest |
@MichaelDeBoey |
|
@@ -1,6 +1,5 @@ | |||
name = "remix-cloudflare-workers" | |||
|
|||
account_id = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed account_id
due to the following warning during deployment.
$ wrangler publish
⛅️ wrangler 2.0.22
--------------------
▲ [WARNING] Processing wrangler.toml configuration:
- The "account_id" field in your configuration is an empty string and will be ignored.
Please remove the "account_id" field from your configuration.
I rebased to the latest main and then resolved the conflicts. I updated to the latest wrangler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still wondering if we also need a wrangler.toml
for cloudflare-pages
🤔
CC/ @jacob-ebey
@MichaelDeBoey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
Update template for cloudflare workers. (#3158)
wrangler.toml
: Changed to wrangler v2 style.package.json
: Added wrangler to dependecncies. Updated @cloudflare/workers-types latest. (also pages template)remix.env.d.ts
: Fixed dead link. (also pages template)README
: Removed the sentence about installation of wrangler.I have confirmed that it is deployable. (https://github.com/aiji42/remix-cf-wrangler-2)