Description
We currently generate edge functions manifests with patterns generated from the middleware-manifest matcher regexp. The problem is that this now uses named capture groups, which have a different syntax in golang than JS.
In JS, a named capture group has the form (?<id> ...
but Golang needs the equivalent to be (?P<id> ...
. Right now when converting the JS pattern into Golang we just strip lookeaheads. It seems we may also need to convert these named capture groups too.
This is caught by the e2e test edge-render-getserversideprops
, which gives a 500 error for /123
as the edge function does not match, causing it to try to use a lambda, which has invalid syntax
The code is in here: https://github.com/netlify/next-runtime/blob/main/packages/runtime/src/helpers/matchers.ts