-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
levonet/docker-nginx
#1Labels
Description
nginx throw errors after update version of njs to 0.3.8:
2020/02/10 16:18:29 [error] 144#144: *6947506 async operation inside "js_log" variable handler, client: nda, server: nda, request: "POST /nda HTTP/1.1", host: "nda"
r.subrequest
continues to work. In documentation:
Since 0.3.8, if a
callback
is not provided, thePromise
object that resolves to the subrequest response object is returned.
There should be no error if a function has a callback argument. I think so.
Here is a minimal case:
function js_log(r) {
var log = {
// ...
};
var args = {
method: 'POST',
body: JSON.stringify(log)
};
r.subrequest('/_log', args, (res) => {});
return '1';
}
in conf:
js_set $x_js_log js_log;
server {
location / {
proxy_set_header X-Log $x_js_log;
proxy_pass http://backend;
}
location = /_log {
internal;
return 200;
}
}
lexusag and zongzw