Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop pass through request params for function redirects #4897

Merged
merged 4 commits into from
Aug 15, 2022

Conversation

tinfoil-knight
Copy link
Contributor

@tinfoil-knight tinfoil-knight commented Aug 3, 2022

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes #4273

Query parameters specified in function redirects are not being passed (they're over-written by the request parameters) by netlify dev. This is different from currently observed production behaviour.

This is due to an intentional change in #1605 to match the production behaviour at that time.


Difference b/w current local & production behaviour can be verified with the minimal reproduction & production deploy link below:

Minimal reproduction of the issue: https://github.com/KK-Learning-Gym/4273-with-fn (see netlify.toml)

Production Deploy: https://with-fn-testing.netlify.app

Quick Links:

Redirect with config from the updated test in this PR:

https://with-fn-testing.netlify.app/api/test?foo=1&foo=2&bar=1&bar=2

Redirects to
/.netlify/functions/echo?a=1&a=2 on production
/.netlify/functions/echo?foo=1&foo=2&bar=1&bar=2 locally

Redirect with config mentioned in #4273 on production:

https://with-fn-testing.netlify.app/.netlify/functions/bar/?url=bar

Redirects to
.netlify/functions/bar/?url=bar on production
.netlify/functions/bar/?url= locally

Also see #4273 (comment)


This PR attempts to resolve the differences described above b/w netlify dev & production.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)
🦁

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

📊 Benchmark results

Comparing with ec1a05e

Package size: 222 MB

(no change)

^  228 MB                                                                                                 
│   ┌──┐   222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB  222 MB 
│   |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

@tinfoil-knight tinfoil-knight marked this pull request as ready for review August 3, 2022 15:54
@tinfoil-knight
Copy link
Contributor Author

tinfoil-knight commented Aug 3, 2022

Note: I confirmed w/ https://github.com/eric-silverman on Slack for approval before creating the PR for the attached issue.

@danez danez added the type: bug code to address defects in shipped code label Aug 5, 2022
Copy link
Contributor

@danez danez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

Can we add an additional assertion that tests the :splat behavior with functions?

@tinfoil-knight
Copy link
Contributor Author

Can we add an additional assertion that tests the :splat behavior with functions?

Yeah. I'll add a test-case.

@danez
Copy link
Contributor

danez commented Aug 15, 2022

Feel free to merge. You can also use kodiak for merging, by simply adding the automerge label.

@tinfoil-knight
Copy link
Contributor Author

@danez I don't have access to merge or add any labels yet.

@danez
Copy link
Contributor

danez commented Aug 15, 2022

Oh I see, I can merge if you want?

@tinfoil-knight
Copy link
Contributor Author

Oh I see, I can merge if you want?

Yeah. Please do.

@danez danez added the automerge Add to Kodiak auto merge queue label Aug 15, 2022
@kodiakhq kodiakhq bot merged commit 9e1e55b into netlify:main Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Add to Kodiak auto merge queue type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Splat not being passed as Query String
2 participants