openresty / openresty/lua-nginx-module

Error using body_filter_by_lua in config

Open
#1,636 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

version: openresty/1.15.8.2

In config i use:

set $resp_body "";
body_filter_by_lua '
  ngx.ctx.buffered = (ngx.ctx.buffered or "") .. ngx.arg[1]
  if ngx.arg[2] then
     ngx.var.resp_body = ngx.ctx.buffered
  end
';

and for each request i catch this error

[error] 10#0: *1 failed to run body_filter_by_lua*: body_filter_by_lua:2: no request found
stack traceback:
[C]: in function '__index'
body_filter_by_lua:2: in main chunk, client: 172.21.0.2, server: _, request: "POST /logstash/test HTTP/1.1", host: "application.docker.localhost"

If I downgrade to 1.13 version, it works correctly

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied body_filter_by_lua configuration on openresty/1.15.8.2 and the older 1.13 version, then inspect the reported “no request found” traceback. Done means identifying the version-specific cause and documenting or validating the expected behavior for this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.