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

fix: error while trying to log table in ai-content-moderation plugin #11994

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

Revolyssup
Copy link
Contributor

@Revolyssup Revolyssup commented Feb 25, 2025

Description

2025/02/25 04:00:33 [error] 115#115: *8048 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/plugins/ai-content-moderation.lua:151: bad argument #2 to 'error' (expected table to have __tostring metamethod)
stack traceback:
coroutine 0:
        [C]: in function 'error'
        /usr/local/apisix/apisix/plugins/ai-content-moderation.lua:151: in function 'phase_func'
        /usr/local/apisix/apisix/plugin.lua:1205: in function 'run_plugin'
        /usr/local/apisix/apisix/init.lua:681: in function 'http_access_phase'
        access_by_lua(nginx.conf:319):2: in main chunk, client: 172.20.0.1, server: _, request: "POST /post HTTP/1.1", host: "127.0.0.1:9080"

This bug is encountered because a table is passed directly to log function. This PR fixes it.

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Feb 25, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Feb 25, 2025
@Revolyssup Revolyssup merged commit adaa080 into apache:master Feb 25, 2025
31 checks passed
@Revolyssup Revolyssup deleted the revolyssup/ai-content branch February 25, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants