hassio-addons/addon-nginx-proxy-manager

Network check during cert issuing causes full crash

pwnpanda opened this issue · 1 comments

Problem/Motivation

(Why the issue was filed)

Network connectivity check causes full crash of the add-on

Expected behavior

(What you expected to happen)

The network check works normally and responds with either network state OK or network state down

Actual behavior

(What actually happened)

The addon crashes completely when the check is performed, due to the JSON response not being parseable / as expected.
This is the button pressed:
New Project

Logs:

 -----------------------------------------------------------
 Add-on: Nginx Proxy Manager
 Manage Nginx proxy hosts with a simple, powerful interface
-----------------------------------------------------------
 Add-on version: 1.0.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 11.4  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2024.1.3
 Home Assistant Supervisor: 2023.12.0
-----------------------------------------------------------

... SNIPPING OUT NORMAL STARTUP ...

[1/14/2024] [10:33:28 AM] [SSL      ] › ℹ  info      Testing http challenge for <DOMAIN>
Uncaught SyntaxError: Unexpected end of JSON input

FROM
2024/01/14 10:33:29 [error] 227#227: *14 upstream prematurely closed connection while reading response header from upstream, client: <MyClientIP>, server: nginxproxymanager, request: "GET /api/nginx/certificates/test-http?domains=%5B%22<DOMAIN>%22%5D HTTP/1.1", upstream: "http://127.0.0.1:3000/nginx/certificates/test-http?domains=%5B%22<DOMAIN>%22%5D", host: "<HomeAssistantIP>:81", referrer: "http://<HomeAssistantIP>:81/nginx/certificates"
JSON.parse (<anonymous>)IncomingMessage.<anonymous> (/opt/nginx-proxy-manager/internal/certificate.js:1178:31)IncomingMessage.emit (node:events:529:35)endReadableNT (node:internal/streams/readable:1400:12)process.processTicksAndRejections (node:internal/process/task_queues:82:21)[10:33:29] INFO: Service Nginx Proxy Manager exited with code 256 (by signal 5)

Steps to reproduce

(How can someone else make/see it happen)
Click the button in the screenshot above, on the newest version of the addon, after inputting a domain name.
Check the addon logs to find the details of the crash.

Proposed changes

(If you have a proposed change, workaround or fix,
describe the rationale behind it)

Probably review the network request and response, and verify that the JSON response is as expected.

I will try to research this in my spare time, and see if I can make a patch, but I don't have much time currently so don't expect to much.

Thank you for your hard work on the addon!

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!