excludePath not matching in netlify.toml for edge function

I’m using an edge function to rewrite HTML responses to pre-built DCZ-compressed versions (ZSTD compression dictionaries), it’s all working except I can’t seem to negate functions using excludePath in the netlify.toml file as per the documentation here.

My configuration is as follows:

[[edge_functions]]
  function = "compression-dictionary-rewrite"
  path = "/*"
  excludedPath = "/*.dcz"
  [edge_functions.header]
  accept = "text/html"
  accept-encoding = "dcz"
  available-dictionary = true
  dictionary-id = true

My function contains a log message that (if the config is working properly) should never be output:

// we don't rewrite requests that are already for .dcz files
if (url.pathname.toLowerCase().endsWith(".dcz")) {
  console.log("Request is already for a .dcz file, skipping dictionary rewrite.");
  return;
}

But this is appearing in my logs (see last line below):

01KAPGEK info   [compression-dictionary-rewrite] Compression Dictionary Rewrite Edge Function invoked for /
01KAPGEK info   [compression-dictionary-rewrite] Rewriting / to /index.html-b133bf1c52766a9023afe70952fb0039.dcz
01KAPGEK info   [compression-dictionary-rewrite] Compression Dictionary Rewrite Edge Function invoked for /index.html-b133bf1c52766a9023afe70952fb0039.dcz
01KAPGEK info   [compression-dictionary-rewrite] Request is already for a .dcz file, skipping dictionary rewrite.

Is there some reason this isn’t working? I’ve tried testing the excludedPath with URLPattern (as per other threads on the forum) and it should match, so those requests should be ignored?

What site is this about? Also,

is invalid config. Seems AI generated?

This is the relevant site (link to branch preview):

That config isn’t AI generated, Netlify’s own documentation explains it here. It basically means I only match on requests based on:

  • Accept header including the string text/html
  • Accept-Encoding header including dcz
  • Available-Dictionary header being present
  • Dictionary-ID header being present

This is all to do with compression dictionaries.

@hrishikesh can I please get an update on this, is it being looked at? Let me know if I’m better submitting a support ticket, I just figured it would be better to discuss in the open incase others have the same problem in future.

If anyone else comes across this issue: I’ve been told by support that the config will only sync properly once the function has been deployed to production. They have taken note to update the documentation.

On the flip side, I’ve found that the config appears to be working properly when defined as a JavaScript export instead of within the `netlify.toml`, so that might be a workaround for others.