Hi everyone - we're exploring deploying our Remix app to CF Pages. We can't do the whole hook-up you

Hi everyone - we're exploring deploying our Remix app to CF Pages. We can't do the whole hook-up your repo and let CF do the magic because we're running a mono-repo with various projects in it, so we'd like to push it. I found somewhere that we can use wrangler, and wrangler is deploying the assets to the pages, but I must be missing something, because I see no workers defined and going to the preview URL gives me a 404.
12 Replies
oldmanmeta
oldmanmeta2y ago
Hi - I got a failure on pages deployment when it opts for v2 of the build system. When I run v1 all is good. Apologies if someone has already raised this, but it's not immediately obvious why it isn't working beyond saying that webpack is not found Here is the log error:
22:21:28.531 Executing user command: webpack --config webpack.config.js
22:21:28.542 /bin/sh: 1: webpack: not found
22:21:28.543 Failed: Error while executing user command. Exited with error code: 127
22:21:28.552 Failed: build command exited with code: 1
22:21:28.531 Executing user command: webpack --config webpack.config.js
22:21:28.542 /bin/sh: 1: webpack: not found
22:21:28.543 Failed: Error while executing user command. Exited with error code: 127
22:21:28.552 Failed: build command exited with code: 1
James
James2y ago
Build image v1 added the local node_modules/.bin to PATH so this kinda thing worked, but was a little non-standard. Build image v2 no longer does this, so the recommended approach is via an npm run script, or npx. If you add webpack --config webpack.config.js to an npm run script like build and then use npm run build as your build command, things should work as expected.
oldmanmeta
oldmanmeta2y ago
Thanks - that was what I tried first as it is added to a build script, but it just kept failing the build hence the reason why it shows the build command as webpack --config webpack.config.js
David
David2y ago
Thanks, I was having some trouble with nextjs server components, but tried a fresh project and got a basic one working. Will keep exploring it.
Murder Chicken
I'm banging my head against the wall trying to get a Pages function to be able to use a service binding locally. Both the pages application and the target bound worker are deployed and I have the service binding setup in the Pages wrangler.toml file as well but the binding is always undefined. Using wrangler v3x, with both the pages and worker running, do I need to pass a flag locally when starting up the pages application in order for the two to be able to communicate? I see flags for pages dev for DO, KV, D1 and R2 but there's nothing in there for worker bindings.
James
James2y ago
I do not believe that's possible in dev today unfortunately. You can follow https://github.com/cloudflare/workers-sdk/pull/2162 for updates.
Murder Chicken
Yeah, I'm actually just reading up on that now. So no functional worker bindings from pages locally... ugh. Okay, thank you James.
JustinNoel
JustinNoel2y ago
maybe check out this new HBO Max and Hono combination buy one of the Cloudflare employees. https://github.com/yusukebe/hono-htmx
GitHub
GitHub - yusukebe/hono-htmx: Hono+htmx stack
Hono+htmx stack. Contribute to yusukebe/hono-htmx development by creating an account on GitHub.
kika
kika2y ago
seems that #pages-help is dead, maybe someone here knows it: what git command does Cloudflare Pages build system uses to clone the repo? I can't get access to the tag from the build script
Cyb3r-Jak3
Cyb3r-Jak32y ago
What build image are you on? My guess is that is does a checkout of the latest commit which is included in the payload.
kika
kika2y ago
v1 I'd love to see the exact command line to reproduce it locally and try to dig out the tag git is like perl - there's always more than one way to do it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server