Issues with Worker Template Code
-
Hi,
I am trying to implement the worker in my CF account as it did not get pushed when activating the plugin.
I notices multiple errors (mainly type errors) in the code when adding the code from
assets/js/worker_template.js
(by copy/pasting) into the CloudFlare worker code editor.Also I did a small optimization to the code I think might be useful to integrate:
in theurl_normalize
function, instead of the costlyfor
loop, I suggest using:// Directly iterate over searchParams and delete if found in THIRD_PARTY_QUERY_PARAMETERS
THIRD_PARTY_QUERY_PARAMETERS.forEach(param => {
if (reqURL.searchParams.has(param)) {
reqURL.searchParams.delete(param);
}
});Please have a look into the type errors and other errors that appear when you copy the code into cloudflare code editor and advise.
Best.
- The topic ‘Issues with Worker Template Code’ is closed to new replies.