Deploying with wrangler.toml with a Service Binding stuck in Queued state

I have a Next.js app I'm trying to deploy to Pages, that has a Service Binding. The only problem is that when I run wrangler deploy [...] it all shows successfully in my CLI, but in the Pages Deployments list page, the new deployment shows up in the "Queued" state forever. There are no errors as far as I can tell, and the UI doesn't really show any useful information. If I deploy without the Service Binding - that deployment goes through fine. Then if I go to the settings and manually add the Service Binding (which also requires me to have done the deploy without the wrangler.toml file btw), and then deploy again (because for some reason the bindings don't apply to current deployment - I assume for some good reason, but it was a little annoying to discover that haha, anyways), then the latest deployment gets the Service Binding just fine. I think I've tried everything I can to diagnose this problem... but now I need help from somebody with a little more visibility πŸ˜› The only reason I didn't tag next-on-pages is because I also deployed a Remix app last week and, from memory, it did the exact same thing. At the time I just assumed it was a problem with Remix, hence switching to Next.js. But it just appears to be a wrangler.toml issue, maybe?
10 Replies
Jacob Marshall
Jacob MarshallOPβ€’8mo ago
I've just re-replicated it with the Remix app I was playing with a week or so ago. Same exact behaviour. Something else of potentially significant importance is that the service I'm binding to exposes a default RPC (aka. export default class extends WorkerEntrypoint { ... }) which does implement fetch but also implements a whole bunch of other RPC methods. I thought I'd try to see what would happen if I swapped out the service binding for a KV namespace (using the wrangler.toml file)... and that works just fine. So hopefully I'm helping to narrow the problem haha. But yeah, it feels more and more like the issue is related to Service Bindings with everything I try. Also I tried using a Service Binding that doesn't have any Worker Entrypoints defined (no RPC), and that failed too. Just to try and rule out RPC related stuff (given they're so new).
kian
kianβ€’8mo ago
What's your Wrangler.toml?
Walshy
Walshyβ€’8mo ago
^ a repro wrangler.toml would be great πŸ™‚
thipperz
thipperzβ€’8mo ago
The same thing happened to me because my service bindings were defined more than once in my wrangler.toml file (can't use the same BINDING_NAME twice for service bindings) - not sure if that's intented though
Jacob Marshall
Jacob MarshallOPβ€’8mo ago
Oh yeah, my bad. I should have supplied my wrangler.toml file to begin with πŸ€¦β€β™‚οΈ
name = "2014-04-14-my-remix-app"
compatibility_date = "2024-04-05"
pages_build_output_dir = "./build/client"

[[services]]
binding = "USERS"
service = "users-service"
name = "2014-04-14-my-remix-app"
compatibility_date = "2024-04-05"
pages_build_output_dir = "./build/client"

[[services]]
binding = "USERS"
service = "users-service"
This config is just the standard one that gets generated when I ran npm create cloudflare@latest 2014-04-14-my-remix-app -- --framework=remix minus all the boilerplate comments. I also tried the other syntax:
name = "2014-04-14-my-remix-app"
compatibility_date = "2024-04-05"
pages_build_output_dir = "./build/client"
services = [
{ binding = "USERS", service = "users-service" }
]
name = "2014-04-14-my-remix-app"
compatibility_date = "2024-04-05"
pages_build_output_dir = "./build/client"
services = [
{ binding = "USERS", service = "users-service" }
]
And that yields the exact same thing.
No description
Jacob Marshall
Jacob MarshallOPβ€’8mo ago
As you can see... not much going on in the wrangler.toml file πŸ˜‚ Is anybody able to confirm this is not intended behaviour? I’m pretty sure my config is correct.
thanhle
thanhleβ€’8mo ago
No description
thanhle
thanhleβ€’8mo ago
can you try to add environment="production"
Jacob Marshall
Jacob MarshallOPβ€’8mo ago
Omg thank you @thanhle, you are a legend! I really hope they fix this because it’s been very frustrating to work around.
thanhle
thanhleβ€’8mo ago
i am glad this helps
Want results from more Discord servers?
Add your server