Initializing
My worker is stuck on
Initializing workers.dev subdomain...
is that due to the outages26 Replies
New account or worker? It is very likely related, I was getting that earlier though on existing workers when the incidient/api was worse.
Does it prevent you from editing your worker or accessing it?
The worker was just made today. I can edit and access it and it says it deployed successfully but it says Initializing workers.dev subdomain...
If it's not causing issues, I would just advert your eyes from it for now, should go away when the incident is over
By "access it", you mean actually trigger the worker right? If it doesn't show you the url, it'd just be <worker-name>.yoursubdomain (shown in overview).workers.dev
I mean I can access its settings. The worker domain is inaccessable
ah ok, yea this is def related to the outage, interesting though. Is this the first worker on your account or something? I can seem to create new ones fine on my end
My first worker yes
It's gotta do some setup then for your worker.dev domain I imagine. You could try adding a worker custom domain on one of your domains (if you have any in Cloudflare & if you can access it that menu under Triggers of the Worker), otherwise you'll probably just need to wait it out
Its fairly basic I want a URL that I can give a ?code=somestring query and it will make a POST request to a different url with the body as {"content":somestring}
yea, it's not about the worker code itself or anything, just about the ongoing service issues: https://www.cloudflarestatus.com/incidents/hm7491k53ppg
Any alternatives that can achieve that?
Converting a query string to a POST Request on a different url? Only Workers would be dynamic enough to do anything like that
If you want to add this over an existing web server/origin, you could try adding the http route for it, it sounds like to me it's just the workers.dev domain having issues and not the worker itself
Basically a GET request to the worker or whatever service url.com?code=MyString
A POST request to another URL with body={"content":MyString}
The only Cloudflare product that can really do dynamic stuff like that would be Workers
You have the right answer to your question, just need to wait for service to be restored, or try adding a custom domain/route to the Worker to try to get around the worker.dev issues
Its deploying and its no longer stuck on
Initializing workers.dev subdomain...
but whenever I try to access the worker but its doing this insteadSorry I forgot to turn off ping
And for some reason it says my worker has 71 requests
The error message is:
Cannot read properties of undefined (reading 'webhook')
I have a secret called webhook
Im getting it with event.env.webhookNew Workers get issued a certificate (*.workername.subdomain.workers.dev), which go into the Certificate Transparency (CT) Logs, so you get a bit of bot traffic
what's your code look like? If you're using module workers, you'd just grab
env
off the request. If old service workers with addEventListener
, then they're just globals. event
sounds like either a framework or something elseI ended up just not using an environment variable. yeah I was using addEventListener to get the event and using event.env
there's no env on event with addEventListener/service workers
environment variables are just globals
So how do I get it?
If you named it webhook, would just be
webhook
or globalThis.webhook
thanks
no problem, if you can, I would consider migrating and using Module Format instead of Service Worker format/addEventListener:
https://developers.cloudflare.com/workers/learning/migrate-to-module-workers/
Service Worker Format does not/will not support all future features and bindings, and it's slower and more messy
For example, with module workers, that'd be like this:
Migrate from Service Workers to ES Modules · Cloudflare Workers docs
Write your Worker code in ES modules syntax for an optimized experience.
no rush though, the guarantee with Workers is that old code will always keep running thanks to compatibility dates and such, not going to have service worker format workers stop working one day
I was doing that first but when i was calling fetch() to make a POST request to the webhook it was trying to call itself
The online editor is a bit silly and tries to autosuggest
this.fetch()
on autocomplete, make sure you're not doing that
just bare fetch()
is what you needI did and it said it requires 3 arguments but only 2 were given. The 3 refering to request, env and ctx