Workers main URL Redirect not working, Params as well

Hi, Alief here. I’m new here and can only include 2 links.
I’m trying to use Workers to redirect a subdomain to a different domain, but it’s not working:
wa.example to wa.me/60123456789

And its path, which works well:
wa.example/WantToBuy to /60123456789?text=Want%20To%20Buy

Also, I’m unable to remove params (fbclid) from the subdomain in the same script.

The route for this worker is wa.example.com/*

How do I make it work? Thank you in advance.

Here is my full script:

addEventListener('fetch', event => {
  event.respondWith(fetchAndApply(event.request))
})

async function fetchAndApply(request) {

let url = new URL(request.url);
let path = url.pathname;

var yourNumber = "60123456789"
const yourMessage = "'"+path+"'"

  number = yourNumber
  message = yourMessage.match(/(\d+|[a-z]+|([A-Z]([A-Z]+|[a-z]*)))/g).join('%20')

let whatsapp = 'wa.me/' + number + '?text=' + message

return fetch(whatsapp,request);
}

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

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

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