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

Mashape analytics plugin causing error after 0.6.0 upgrade #938

Closed
PGBI opened this issue Feb 3, 2016 · 3 comments
Closed

Mashape analytics plugin causing error after 0.6.0 upgrade #938

PGBI opened this issue Feb 3, 2016 · 3 comments
Labels

Comments

@PGBI
Copy link

PGBI commented Feb 3, 2016

After upgrading to v0.6.0, Kong was returning a 504 error when requesting a given API. The logs were showing:

2016/02/03 13:49:14 [error] 20954#0: *774 failed to run body_filter_by_lua*: ...share/lua/5.1/kong/plugins/mashape-analytics/handler.lua:75: attempt to index field 'analytics' (a nil value)
stack traceback:
        ...share/lua/5.1/kong/plugins/mashape-analytics/handler.lua:75: in function 'body_filter'
        /usr/local/share/lua/5.1/kong.lua:184: in function 'body_filter'
        body_filter_by_lua:1: in function <body_filter_by_lua:1>, client: 10.0.2.225, server: _, request: "POST xxx HTTP/1.1", host: "xxx"

2016/02/03 13:49:14 [error] 20954#0: *774 failed to run log_by_lua*: ...local/share/lua/5.1/kong/plugins/log-serializers/alf.lua:94: attempt to index local 'analytics_data' (a nil value)
stack traceback:
        ...local/share/lua/5.1/kong/plugins/log-serializers/alf.lua:94: in function 'serialize_entry'
        ...local/share/lua/5.1/kong/plugins/log-serializers/alf.lua:183: in function 'new_alf'
        ...share/lua/5.1/kong/plugins/mashape-analytics/handler.lua:92: in function 'log'
        /usr/local/share/lua/5.1/kong.lua:192: in function 'log'
        log_by_lua(nginx.conf:109):1: in function <log_by_lua(nginx.conf:109):1> while logging request, client: 10.0.2.225, server: _, request: "POST xxx HTTP/1.1", host: "xxx"

After turning off the log_body option of the mashape-analytics plugin, and turning it on again, everything went back to normal.

Any idea what may causes this?

@thibaultcha
Copy link
Member

Any idea what may causes this?

Yes, there is even a fix for it in #931!

This should have happened after a request was interrupted, causing the ALF serializer to not have all the data it needs to build the log.

@thibaultcha
Copy link
Member

#931 has been merged and soon to be released.

@PGBI
Copy link
Author

PGBI commented Feb 4, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants