You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the development of custom Kong plugins, I found that I couldn't use kong.db to query entities. Whenever I executed kong.db.xxxx, the process would block, and the code could not proceed to the next step, though it could be used within ngx.timer.at. I have tried multiple versions of Kong, all with the same result. I am certain that I have taken the following measures:
1.Turned on the logging switch and set it to debug level.
2.Allowed in the execution phase, specifically in the access phase.
3.I tried using third-party libraries, such as luasql.postgres, which work perfectly.
4.The database is normal and connectable. I have checked the status API, and the database is accessible.
Demo
function handler:access(config)
kong.log.info("accessing database")
local entity, err = kong.db.entities:select({ id = "some-id" })
if err then
kong.log.err("Error accessing database: ", err)
return kong.response.exit(500, { message = "Internal Server Error" })
end
if not entity then
return kong.response.exit(404, { message = "Entity not found" })
end
end
Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
This an issue in 3.7.0 too? I think I have a custom plugin that used kong.db.* so this may be problematic for me too if it is the case. But don't other kong native plugins access the db in the access phase too? Wonder why they would all not be having major issues too if so.
Kong
locked and limited conversation to collaborators
Jul 15, 2024
Is there an existing issue for this?
Kong version (
$ kong version
)3.4 or 3.5 or 3.6
Current Behavior
During the development of custom Kong plugins, I found that I couldn't use kong.db to query entities. Whenever I executed kong.db.xxxx, the process would block, and the code could not proceed to the next step, though it could be used within ngx.timer.at. I have tried multiple versions of Kong, all with the same result. I am certain that I have taken the following measures:
1.Turned on the logging switch and set it to debug level.
2.Allowed in the execution phase, specifically in the access phase.
3.I tried using third-party libraries, such as luasql.postgres, which work perfectly.
4.The database is normal and connectable. I have checked the status API, and the database is accessible.
Demo
Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: