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

Leaving out path in endpoint declaration let RIG fail on startup #334

Closed
KaWigg opened this issue Oct 28, 2020 · 2 comments · Fixed by #335
Closed

Leaving out path in endpoint declaration let RIG fail on startup #334

KaWigg opened this issue Oct 28, 2020 · 2 comments · Fixed by #335
Assignees
Labels
Milestone

Comments

@KaWigg
Copy link

KaWigg commented Oct 28, 2020

Summary and context

Rewriting URLs in API Gateway only works when using regex catch groups, so we need to use path_regex instead of path when defining the path. Leaving out path declaration leads to a validation error on startup.

How to reproduce

When I run RIG with this endpoint:

{
  "id": "get-entry",
  "path_regex": "/entries/(([\\d\\w])*(-([\\d\\w])*))",
  "path_replacement": "/api/entries/\\1",
  "method": "GET",
  "secured": false
}

..I see the following error and/or log output:

module=RigInboundGateway.ApiProxy.Validations [error] Wrong reverse proxy configuration: [{"service-endpoint/get-entry", [{:error, "path", :by, "must be string"}, {:error, "path", :length, "must have a length of at least 1"}]}]

..but I really expected this:

Normal startup because path_regex is set instead of path. This is also used in your tests and here Forwarding Requests
OR
Allow dynamic parameters introduced by {dynamic_paramter} to be used in path_replacement, like

{
   "id": "get-entry",
   "path": "/entries/{entry_id}",
   "path_replacement": "/api/entries/{entry_id}",
   "method": "GET",
   "secured": false
}

Versions (please complete the following information):**

  • Latest docker image accenture/reactive-interaction-gateway:latest
  • Reactive Interaction Gateway 3.0.0-alpha.1 [rig@127.0.0.1, ERTS 10.7.2.3, OTP 22]
@mmacai
Copy link
Collaborator

mmacai commented Oct 28, 2020

@KaWigg Thank you! I'll check it tomorrow through out the day.

@mmacai mmacai self-assigned this Oct 28, 2020
@kevinbader kevinbader removed their assignment Oct 29, 2020
@kevinbader kevinbader added this to the 3.0.0 milestone Oct 29, 2020
@mmacai
Copy link
Collaborator

mmacai commented Oct 29, 2020

@KaWigg can you give this a shot #335?

Btw, if you don't need auth, you don't have to set secured property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants