Redirect to Function - Splat is not working as expected

Hey @Dennis! I finally got a few minutes to play with some of this again.

Dec 2020 Update:

1) - The desired sort of redirect (taking a path and making it a URL string parm on the other side) still does not work as we’d think:

images/* /.netlify/functions/image-processor?image=:splat 200

On the incoming function, the event.queryStringParameters === {} so for now, I continue to believe that the above-mentioned workaround remains the best option.

2) - @brun0’s trick above does appear to work, but forces all calls to the production function, which is a roadblock for local development.

3) - @janpio’s note is concerning, although I haven’t noticed this myself and my project continues to work generally fine leveraging the workaround noted above.

@Dennis - per this thought, I’d read through some of the source behind the netlify-redirect-parser a few months back and I did leave believing that the * section of the URL was being understood and contained correctly, but my presumption was that the netlify-redirector itself (closed source) wasn’t satisfied with that value or perhaps has some syntax restrictions around a rewrite that leverages a query string parameter. Not sure.

To point out, the correct and working way to handle paths to a function, as mentioned by @jonsully, is to use the path by doing this:

/images/* /.netlify/functions/image-processor/:splat 200

The path can be accessed using event.path inside the function.

Also, @jonsully, I think the issue with using path as querystring param values is that it can have a slash in it. And if unescaped, the slash would make the whole querystring invalid.

That said, your first guess that the issue is with the value is what I have found to be the cause. And a related bugfix that was rollbacked should address this issue when redeployed. I don’t know when that will be yet but I recommend keeping an eye on that if you want to use paths as querystring param values.