`deck validate` not catching a missing `#` at the end of a route
- Dominant language
- Go
- Stars
- 503
- Forks
- 137
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 20
Description
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:
```yml
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`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running `deck validate` against the declarative configuration shown in the issue and trace the validation path for the route expression. Confirm that the missing `#` is rejected before deployment, with the result matching the container's validation failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100