Opened 7 years ago

Closed 7 years ago

#1297 closed defect (invalid)

Javascript Engine:IoT tutorial not working

Reported by: florinpatan@… Owned by:
Priority: blocker Milestone:
Component: nginx-module Version: 1.12.x
Keywords: Cc:
uname -a: Linux f8a42a2b6a07 4.10.0-24-generic #28-Ubuntu SMP Wed Jun 14 08:14:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.12.0
built by gcc 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)
built with OpenSSL 1.0.2l 25 May 2017
TLS SNI support enabled
configure arguments: --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/run/ --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-http_ssl_module --with-http_v2_module --with-file-aio --with-threads --with-http_auth_request_module --with-stream --with-mail=dynamic --add-module=/tmp/njs/nginx



I'm following the IoT tutorial from here:

However, it seems that I cannot produce a valid configuration for nginx.

I'm validating the configuration with nginx -t but it seems that it's failing silently.

Step 11/12 : RUN /usr/sbin/nginx -t -c /etc/nginx/config/nginx.conf
 ---> Running in c7cde3c91ccc
nginx: configuration file /etc/nginx/config/nginx.conf test failed
The command '/bin/sh -c /usr/sbin/nginx -t -c /etc/nginx/config/nginx.conf' returned a non-zero code: 1

This issue is 100% reproducible, I've created the following project for it: which you can clone and reproduce it.

I've tried to identify from where the issue might come from and I can tell you that removing the following line:

js_include mqtt.js;

from mqtt.conf will result in the container successfully being built.

I've tried to reduce the JS file to just this:

function getClientId(s) {
    return s.OK;

function setClientId(s) {
    return "-";

and the configuration would still fail.

I've also tried to clone the JS module at various different revisions, without luck.

Am I doing something wrong? If so, can you please explain what as I can't see anything else that I can try and do at this point.

Please let me know if you need any further details.

Thank you for your time and help.

Attachments (1)

Dockerfile.patch (747 bytes ) - added by xeioex 7 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Liam Crilly, 7 years ago

Your environment is failing because nginScript requires PCRE UTF-8. Your Dockerfile build output includes:

pcre-8.40 configuration summary:
    Enable UTF-8/16/32 support ...... : no 

We are investigating why this results in a silent error.

You may find it easier to continue the tutorial by starting with the official Dockerfile and copy-in your config. This will use the binaries from our official repo. nginScript will be loaded as a dynamic module which means you will need to modify your nginx.conf to include:

load_module /etc/nginx/modules/;

I tested this approach with your config with no problems.

by xeioex, 7 years ago

Attachment: Dockerfile.patch added

comment:2 by xeioex, 7 years ago

See the patch above for your Dockerfile.

comment:3 by florinpatan@…, 7 years ago

Hi xeioex, liam,

Thank you both for your replies.
I can confirm that just adding the change on the line 9 in the patch sent above fixes the problem. Sorry for the noise and thank you so much for the quick reply.

Kind regards,

comment:4 by xeioex, 7 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.