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

Impossible to modify request body with Lura v2.1.0 #26

Closed
mzanibelli opened this issue Oct 5, 2022 · 6 comments
Closed

Impossible to modify request body with Lura v2.1.0 #26

mzanibelli opened this issue Oct 5, 2022 · 6 comments
Labels

Comments

@mzanibelli
Copy link

Hello! This is a follow up of this comment.
I upgraded to Lura v2.1.0 our krakend-ce installation and Martian configurations seem to break.

I have the feeling that this bug is caused by:

  • this change
  • Which does not work with pieces of code like this

Could this be the cause?

Thanks 😄

@mzanibelli
Copy link
Author

mzanibelli commented Oct 5, 2022

Example configuration:

{
  "endpoint": "/debug/plain",
  "method": "GET",
  "output_encoding": "no-op",
  "backend": [
    {
      "url_pattern": "/",
      "encoding": "no-op",
      "method": "POST",
      "host": ["http://127.0.0.1:8895"],
       "extra_config": {
        "modifier/martian": {
          "fifo.Group": {
            "scope": ["request"],
            "aggregateErrors": true,
            "modifiers": [
              {
                "body.Modifier": {
                  "scope": ["request"],
                  "body": "dmVyc2lvbj01"
                }
              },
              {
                "header.Modifier": {
                  "scope": ["request"],
                  "name": "Content-Type",
                  "value": "application/x-www-form-urlencoded"
                }
              }
            ]
          }
        }
      }
    }
  ]
}

I should be able to see version=5 in the request body received by the backend.
Edit: simplified configuration, copy pasted in the middle of weird tests.

@taik0
Copy link
Member

taik0 commented Oct 5, 2022

This configuration seems to work for me:

[KRAKEND] 2022/10/05 - 15:48:41.060 ▶ DEBUG [ENDPOINT: /__debug/*] Method: POST
[KRAKEND] 2022/10/05 - 15:48:41.060 ▶ DEBUG [ENDPOINT: /__debug/*] URL: /__debug/maritan
[KRAKEND] 2022/10/05 - 15:48:41.060 ▶ DEBUG [ENDPOINT: /__debug/*] Query: map[]
[KRAKEND] 2022/10/05 - 15:48:41.061 ▶ DEBUG [ENDPOINT: /__debug/*] Params: [{param /maritan}]
[KRAKEND] 2022/10/05 - 15:48:41.061 ▶ DEBUG [ENDPOINT: /__debug/*] Headers: map[Accept-Encoding:[gzip] Content-Length:[9] Content-Type:[application/x-www-form-urlencoded] User-Agent:[KrakenD Version 2.1.0] X-Forwarded-For:[172.17.0.1] X-Forwarded-Host:[localhost:8080]]
[KRAKEND] 2022/10/05 - 15:48:41.062 ▶ DEBUG [ENDPOINT: /__debug/*] Body: version=5
[GIN] 2022/10/05 - 15:48:41 | 200 |    3.943291ms |      172.17.0.1 | POST     "/__debug/maritan"
[GIN] 2022/10/05 - 15:48:41 | 200 |   55.671417ms |      172.17.0.1 | GET      "/martian"

@mzanibelli
Copy link
Author

Interesting... thanks for your feedback. I'll dig a bit more.

@mzanibelli
Copy link
Author

  • I did go get -u ./...
  • Somehow github.com/spf13/viper got updated to v1.13.0
  • Recurse into arrays when converting keys to lowercase spf13/viper#1387 is causing havoc, converting all extra_config keys to lowercase, recursively
  • I get parse: unknown modifier: fifo.group (note lowercase g)
  • I had a mistake in my krakend-ce setup that prevented this bad boy to show up, leading to a much longer debug session 😓

PSA: Viper 1.13.0 does not work (yet) with KrakenD.

@taik0
Copy link
Member

taik0 commented Oct 6, 2022

Thank you for reporting this @mzanibelli !

@github-actions
Copy link

github-actions bot commented Jan 5, 2023

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.

@github-actions github-actions bot added the locked label Jan 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants