#request.cf.botManagement.score not working

6 messages · Page 1 of 1 (latest)

velvet tiger
#

request.cf.botManagement.score not working after building from ts? I dont use ts much so i have no idea why this is happening:

`"exceptions": [
    {
      "name": "TypeError",
      "message": "Cannot read properties of undefined (reading 'score')",
      "timestamp": 1691488611986
    }
  ],
 

I tried it again in vanilla and it does not work there either, I had it working yesterday and got the 99 score, I'm unsure what changed today to make it non functional

export default {
  async fetch(request, env, ctx) {
    return new Response(`score: ${request.cf.botManagement.score}`);
  },
};
thorn crypt
velvet tiger
#

i guess it was that, I'm not on enterprise

thorn crypt
velvet tiger
#

Thank you

thorn crypt
# velvet tiger Thank you

It turns out it's a bit more complex then I thought:
Here's a full story:
CF accidentally gave Bot management via the cf.botManagement field to everyone, they removed it (opps!), and broke things. So they added it back in with dummy values.

It turns out, now, as of August 1st, they are defaulting (via Worker compat dates) to removing it again.
If your Worker compat date is greater then August 1st, like if you deployed from dash, you'll default to it being gone. You can set the compat flag cf_botmanagement_default to have it back. If you are before that compat date and want to disable it, you can set the compat flag no_cf_botmanagement_default

Most likely the worker you were testing before had a compat date before August 1st