queryStringParameters not working with redirect on production

I have following redirect rule:

from = "/feed/:series/"
to = "/.netlify/functions/feed-builder/?series=:series"
status = 200

On netlify dev event.queryStringParameters.series is foobar.

On netlify deploy --prod event.queryStringParameters.series is undefined.

Any idea why?

I made a hack, but i still wonder why this works different on dev and production.

const querySeries = event.queryStringParameters.series
    ? event.queryStringParameters.series
    : event.path.split("/")[2];

I would expect that to work both places, @rane. (And welcome to out community site.)

Would you be willing to please send us a link to the site at Netlify? Also, I think I see this working now when I test (the site I think it is).

Did you get this resolved already?

Url https://5d946a94fe4ee56f05471dab--supla.netlify.com/feed/12345 should return
{"queryStringParameters":{"series":"12345"}} like it return on netlify dev.

Hi @rane, I checked the deploy you mentioned but I didn’t see a function deployed with it: https://app.netlify.com/sites/supla/functions/?scope=deploypreview:null. When I do test supla.netlify.com/feed/12345, it looks like it is working: image. Can you confirm?

Can you check url https://5d946a94fe4ee56f05471dab--supla.netlify.com/feed/1234 ? It should return {"queryStringParameters":{"series":"12345"}}, but it return {"queryStringParameters":{}}.

There are no query string parameters on that URL though, @rane .

It would look like https://site/path?param=value if there were.

Sorry if that’s a distraction from your issue but wanted to make sure we were all using the same terminology while we debug :slight_smile:

I have redirect rule and netlify dev understand that as query string parameter but production version not.

from = "/feed/:series/"
to = "/.netlify/functions/feed-builder/?series=:series"  
status = 200

You can check the source code: https://github.com/raneio/supla-rss
(check netlify.toml and functions/feed-builder.js)

ok, our documentation about query string params is only going to apply to INCOMING params - in the “from” in your example. However, I don’t see any reason why that shouldn’t work on the surface.

Could you tell us what the entire URL you see in your function (when you log it), is? Trying to understand if we just don’t fill in the value properly, or if instead we drop the ?series= part too.

Also might try it without the / at the end of the path and see if that works better:

to = "/.netlify/functions/feed-builder?series=:series"

events in dev and production

Reson why i don’t just use normal query params like ?series=123 is cache. Cache doesn’t respect anything after ? character. So it’s give same content fo ?series=123 and ?series=456.

Hi @rane, I noticed that the path’s value in the event object has the series number. While this doesn’t explain why the query params is not getting passed on, you could try using the path directly instead. Let me know if that workaround works.