I am using the Cloudflare NPM package for Node to create a Workers route like so:
module.exports.addZoneWorkersRoute = async (config) => {
const resp = await cf.zoneWorkersRoutes.add(zone, config).then((response) => {
functions.logger.log("cloudflare:addZoneWorkersRoute success");
return response;
})
.catch((error) => {
functions.logger.error("cloudflare:addZoneWorkersRoute error", error);
return error;
});
}
The config object being passed into the call is structured according to the api documentation
{
pattern: "foo.com/*"
script: "name-of-worker-script"
}
The call works successfully and creates the route, however, instead of showing that the route is assigned to the worker, it displays the text “Workers are disabled on this route”. I then have to go in and manually assign the worker to the route. It seems that the script parameter is not being applied in the api call.
Any ideas?
Thanks.