Skip to content

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

Merged
Revolyssup merged 2 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-content
Feb 25, 2025
Merged

fix: error while trying to log table in ai-content-moderation plugin#11994
Revolyssup merged 2 commits into
apache:masterfrom
Revolyssup:revolyssup/ai-content

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Feb 25, 2025

Copy link
Copy Markdown
Contributor

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
@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