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

deck validate not catching a missing # at the end of a route #1418

Open
ajrice6713 opened this issue Oct 17, 2024 · 0 comments
Open

deck validate not catching a missing # at the end of a route #1418

ajrice6713 opened this issue Oct 17, 2024 · 0 comments

Comments

@ajrice6713
Copy link

ajrice6713 commented Oct 17, 2024

We use deck validate to check our configurations before deploying instances of kong for testing in CI/CD.

I recently ran into an issue where a container would not start because the # was missing from the end of a regex route capture.

The service in our declarative file:

services:
  - name: myService
    host: my-alb-upstreamService.com
    protocol: https
    port: 443
    connect_timeout: 15000
    write_timeout: 30000    
    read_timeout: 30000
    retries: 3
    routes:
      - name: my_route
        priority: 150
        expression: lower(http.path) ~  r#"^/api/v[0-9]+/accounts/[0-9]+/someResource/[a-z0-9-]+/someSubResource(?:/.*)?$"
        preserve_host: true
        strip_path: false

The error output when we started the container:

Error: 2024/10/17 13:33:39 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:730: error parsing declarative config file /kong/declarative/kong.yml:
in 'services':
  - in entry 10 of 'services':
    in 'routes':
      - in entry 1 of 'routes':
        in '@entity':
          - in entry 1 of '@entity': Router Expression failed validation:  --> 1:1[18](https://github.com/Bandwidth/api-dev-config/actions/runs/11386053265/job/31677339752#step:9:19)
  |
1 | lower(http.path) ~ r#"^/api/v[0-9]+/accounts/[0-9]+/someResource/[a-z0-9-]+/someSubResource(?:/.*)?$"
  |                                                                                                                      ^---
  |
  = expected rawstr_char

Adding the missing # allowed my container to start - but I would expect this to have been caught when running deck validate

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

No branches or pull requests

1 participant