How to Remove Redirect search query

Hi I’m having trouble getting search queries removed from my domain using cloudflare workers.

I tried using this link

and it appears to work when using page rules but I want to use cloudflare workers instead. Can anyone guide me in the right direction. The code they have for cloudflare workers appears to be invalid because it has a red bar at the bottom of the deployment that says an unknown exception occurred.

Is this the code you tried? I don’t get an exception error for it. And a Search query gets stripped off.

addEventListener('fetch', event => {
  let url = new URL(event.request.url)

  if (url.searchParams.has('s'))
   url.searchParams.delete('s')

  event.respondWith(
    fetch(url, event.request)
  )
})

Any chance this needs the 5$ paid plan? I saw somewhere that it needs the 5$ plan to get this to work? Before I pay the 5$ can anyone confirm if this needs the paid workers plan.