Skip to content

bug: limit-count plugins don't recognize the redis_port as integer #12318

@huongtq-dm

Description

@huongtq-dm

Current Behavior

Apisix doesn't recognize my redis_port environment variable, which causes the error below. But when I set redis_port: 6379 or 6380, it's working fine.

I created this manifest using ApisixRoute CRDs on k8s

  • match:
    hosts:
    - example.com
    methods:
    - GET
    - POST
    - PUT
    - PATCH
    - DELETE
    paths:
    - /xxx
    name: limit-count-route-xxxyyy
    plugins:
    - config:
    count: 10
    key: http_x_forwarded_for
    key_type: var
    policy: redis
    redis_host: $env://APISIX_REDIS_HOST
    redis_password: $env://APISIX_REDIS_AUTH_KEY
    redis_port: $env://APISIX_REDIS_PORT
    redis_ssl: true
    redis_timeout: 2000
    rejected_code: 429
    time_window: 60
    enable: true
    name: limit-count
    upstreams:
    - name: common-upstream-green

It's work well when redis_port: 6379.

This is the error: - message: "1 error occurred:\n\t* unexpected status code 400; error message: {\"error_msg\":\"failed to check the configuration of plugin limit-count err: then clause did not match\"}\n\n\n"

Expected Behavior

No response

Error Logs

No response

Steps to Reproduce

  1. Run APISIX on k8s
  2. Using the Environment variable to configure the redis_port in rate-limit plugins (limit-count)

Environment

  • APISIX version (run apisix version): helm 2.10.1 and apisix 3.12.0
  • Operating system (run uname -a): docker image with helm chart
  • OpenResty / Nginx version (run openresty -V or nginx -V): N/A
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): etcd:3.5.19-debian-12-r0
  • APISIX Dashboard version, if relevant: N.A
  • Plugin runner version, for issues related to plugin runners: limit-count
  • LuaRocks version, for installation issues (run luarocks --version): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions