You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
It doesn't seem necessary for the edge-bundler to compile these regex patterns, so I created an edge-bundler PR to simply use the patterns as strings: netlify/edge-bundler#226
However, when doing so I realised that we might want to persue an alternative route, which would be to do the syntax transformation in the edge-bundler itself? Would be interested in your thoughts on it.
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 syntaxThe code is in here: https://github.com/netlify/next-runtime/blob/main/packages/runtime/src/helpers/matchers.ts
The text was updated successfully, but these errors were encountered: