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
If a configuration block isn't closed with '}' nginx-linter will crash with the following message:
Unexpected error: Error: Failed to parse: test.conf
Caused by:
SyntaxError: Expected " ", "#", "\n", "\r", "\t", "access_by_lua_block", "balancer_by_lua_block", "body_filter_by_lua_block", "content_by_lua_block", "header_filter_by_lua_block", "init_by_lua_block", "init_worker_by_lua_block", "log_by_lua_block", "rewrite_by_lua_block", "set_by_lua_block", "ssl_certificate_by_lua_block", "ssl_session_fetch_by_lua_block", "ssl_session_store_by_lua_block", "}", or any character but end of input found.
at parseFile (/opt/homebrew/lib/node_modules/nginx-linter/lib/parser/index.js:22:15)
at Array.map ()
at Object.parseFiles (/opt/homebrew/lib/node_modules/nginx-linter/lib/parser/index.js:31:23)
at validate (/opt/homebrew/lib/node_modules/nginx-linter/bin/_cli/commands.js:75:28)
at execute (/opt/homebrew/lib/node_modules/nginx-linter/bin/_cli/commands.js:51:20)
at Object.main (/opt/homebrew/lib/node_modules/nginx-linter/bin/_cli/commands.js:168:16)
at Object. (/opt/homebrew/lib/node_modules/nginx-linter/bin/nginx-linter.js:6:24)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
It would be helpful if the linter could give some hints on what character it's looking for or where in the configuration this is happening.
The text was updated successfully, but these errors were encountered:
jhinch
changed the title
Linter crash if block isn't closed.
Improve the handling of syntax errors to give better error reporting
Aug 18, 2022
Currently the linter assumes valid nginx configuration is provided as input and isn't designed to handle syntax issues.
The current error does report what characters its expecting next but it would need a special handling around end of file to narrow the possible options its looking for
If a configuration block isn't closed with '}' nginx-linter will crash with the following message:
It would be helpful if the linter could give some hints on what character it's looking for or where in the configuration this is happening.
The text was updated successfully, but these errors were encountered: