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
2024/08/19 14:58:25 [error] 36#36: *771 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:24):2: module 'cjson' not found:
no field package.preload['cjson']
no file './cjson.lua'
no file '/usr/local/share/luajit-2.1/cjson.lua'
no file '/usr/local/share/lua/5.1/cjson.lua'
no file '/usr/local/share/lua/5.1/cjson/init.lua'
no file './cjson.so'
no file '/usr/local/lib/lua/5.1/cjson.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
coroutine 0:
[C]: in function 'require'
content_by_lua(nginx.conf:24):2: in main chunk, client: 10.33.45.224, server: , request: "GET /lua HTTP/2.0", host: "sa-vm-sentry-test.sam.loc:5151"
To Reproduce
docker pull fabiocicerchia/nginx-lua
Correcting docker-compose.yml and docker-compose up -d
docker logs container id
See error
Expected behavior
See JSON logs from Sentry
OS: [e.g. iOS]
Browser [e.g. chrome, safari]
Version [e.g. 22]
Additional context
Hello!
I want to check my JSON files from Sentry.
I've set up sentry and use this Docker-image nginx-lua
And when i want to see json from sentry in logs - i've got an error (described above)
What i do wrong?
Here's my nginx.conf
worker_processes auto;
events {
worker_connections 1024;
}
http {
lua_shared_dict request_body 30m;
# Настройка путей для логов
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl_certificate /etc/ssl/svrauto/public.crt;
ssl_certificate_key /etc/ssl/svrauto/private.key;
server {
listen 443 ssl http2;
client_body_buffer_size 20K;
client_header_buffer_size 4k;
client_max_body_size 12m;
large_client_header_buffers 2 12k;
location /lua {
# Обрабатываем POST запросы
content_by_lua_block {
local cjson = require "cjson"
local log = ngx.log
local ERR = ngx.ERR
ngx.req.read_body()
local body = ngx.req.get_body_data()
if body then
local success, json = pcall(cjson.decode, body)
if success then
-- Записываем в лог содержимое JSON
log(ERR, "Received JSON: ", cjson.encode(json))
-- Отправляем JSON как строку
ngx.say(cjson.encode(json))
else
-- Записываем ошибку в лог
log(ERR, "Invalid JSON: ", body)
ngx.status = ngx.HTTP_BAD_REQUEST
ngx.say("Invalid JSON")
end
else
-- Записываем ошибку в лог
log(ERR, "Empty body received")
ngx.status = ngx.HTTP_BAD_REQUEST
ngx.say("Empty body")
end
}
}
}
}
Thanks for any help!
The text was updated successfully, but these errors were encountered:
Describe the bug
Got an error from lua
To Reproduce
docker-compose up -d
Expected behavior
See JSON logs from Sentry
Additional context
Hello!
I want to check my JSON files from Sentry.
I've set up sentry and use this Docker-image nginx-lua
And when i want to see json from sentry in logs - i've got an error (described above)
What i do wrong?
Here's my nginx.conf
Thanks for any help!
The text was updated successfully, but these errors were encountered: