Skip to content

rewrite_by_lua_block {;} in nginx_kong.lua file causes run-time issues #14796

@p-thamke

Description

@p-thamke

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

3.9.1

Current Behavior

With kong 3.9.1, when we hit our service api, kong crashes and throws 500 internal server error with following logs:

2025/11/25 13:30:22 [error] 10601#0: 1289 failed to run balancer_by_lua: .../luarocks/share/lua/5.1/kong/init.lua:1432: attempt to call upvalue 'enable_keepalive' (a nil value)
stack traceback:
.../luarocks/share/lua/5.1/kong/init.lua:1432: in function 'balancer'
balancer_by_lua(nginx-kong.conf:72):2: in main chunk while connecting to upstream, client: 172.17.0.32, server: kong, request: "GET /v1/api HTTP/1.1", host: "url:port", request_id: "******************************"
2025/11/25 13:30:22 [error] 10601#0: *1289 failed to load inlined Lua code: rewrite_by_lua(nginx-kong.conf:330):1: unexpected symbol near ';', client: 172.17.0.32

nginx-kong.conf has following text at line 330 (which looks to be a syntax error from lua point of view):
rewrite_by_lua_block {;}

This error seems to be coming from the kong open source code in file "nginx_kong.lua" line "rewrite_by_lua_block {;}".

We request inputs for this.

Thanks.

Expected Behavior

Expected response is 200 Ok for the service api hit through kong api gateway

Steps To Reproduce

As mentioned in description, we are running kong 3.9.1.
Hit our service api through kong (using curl on command line)
kong crashes and throws 500 internal server error response.
Error logs show the syntax error for rewrite_by_lua_block {;} most likely from file nginx_kong.lua.

Note: We are not adding any additional nginx lua code from any of our modules.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending author feedbackWaiting for the issue author to get back to a maintainer with findings, more details, etc...stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions