NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
21.75k stars 2.51k forks source link

JSON-Error in Backend while generating SSL-Certificates #2796

Open dravorle opened 1 year ago

dravorle commented 1 year ago

Checklist

Describe the bug

I am unable to create an SSL certificate for my websites. The API simply returns a 502-Error after a while, showing the message "Communication with the API failed, is NPM running correctly?". In the Docker-Logs I can see that it fails with the following:

[4/2/2023] [8:38:23 PM] [SSL      ] › ℹ  info      Testing http challenge for domain.de
Uncaught SyntaxError: Unexpected token < in JSON at position 5
FROM
bash: line 1:   134 Trace/breakpoint trap   (core dumped) node --abort_on_uncaught_exception --max_old_space_size=250 index.js
❯ Starting backend ...

If I try a subdomain it fails with another JSON-Error:

[4/2/2023] [8:50:06 PM] [SSL      ] › ℹ  info      Testing http challenge for test.domain.de
Uncaught SyntaxError: Unexpected end of JSON input
FROM
bash: line 1:   126 Trace/breakpoint trap   (core dumped) node --abort_on_uncaught_exception --max_old_space_size=250 index.js
❯ Starting backend ...

I am using the following Compose within a Portainer-Stack:

version: '3.8'
services:
  app:
    container_name: NginxProxyManager
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '127.0.0.1:81:81' # Admin Web Port # I have tried exposing the port completely, but thats not the problem.
      # Add any other Stream port you want to expose
      # - '21:21' # FTP

    # Uncomment the next line if you uncomment anything in the section
    # environment:
      # Uncomment this if you want to change the location of
      # the SQLite DB file within the container
      # DB_SQLITE_FILE: "/data/database.sqlite"

      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'

    volumes:
      - /Docker/nginx-proxy-manager/data:/data
      - /Docker/nginx-proxy-manager/letsencrypt:/etc/letsencrypt

networks:
  default:
    external: true
    name: Nginx-Proxy

I have no idea whats going on, especially because I haven't seen someone have this error before. Everything else works perfectly fine, just anything concerning SSL-Certs is not working. I've also tried previous versions, which result in the same error.

Nginx Proxy Manager Version

2.10.2 (and previous ones)

andzejsp commented 1 year ago

smells like #2713

crosswick commented 11 months ago

I seemingly have the exact same issue with a completely vanilla and by-the-books default install. Docker hello-world test works, NPM administration panel works, DNS domain works (can reach the Apache2 Ubuntu Default Page), but for the life of me I cannot get Test Server Reachability to work when trying to get an SSL certificate. Please help

andzejsp commented 11 months ago

Lost cause

crosswick commented 11 months ago

How do you mean? Is NPM practically abandoned?

andzejsp commented 11 months ago

idk what seems to be the problem, but the newer version of nginxproxymanager seems to throw this error, while older ( the one im running in my lab v2.9.18) seems to work fine.

EDIT:

Oh well.. just tested and yes, its not working on my end anymore :(

crosswick commented 11 months ago

I see... and you thought it might have to do with #2713 ?

andzejsp commented 11 months ago

I see... and you thought it might have to do with #2713 ?

I just tried the following: Go to ssl cert tab (stand alone cert tab in the main page), delete old cert, go to Hosts tab, edit your proxy host, in the ssl tab under that proxy host dont force ssl, and just request new ssl cert. this worked for me just now.

Was reading up on #2011 and #3121, the first one helped, havent treid the new PR docker image that is the second one.

crosswick commented 11 months ago

that just yields an Internal Error for me - the docker log mentions that 'some challenges have failed' and suggests contacting the letsencrypt community

andzejsp commented 11 months ago

that just yields an Internal Error for me - the docker log mentions that 'some challenges have failed' and suggests contacting the letsencrypt community

maybe youre on later veresions, than what i am right now, thats why its throwing you something else.

might be worth looking into using caddy

https://caddyserver.com/docs/

im not associated with caddy but seems pretty hassle free. only downside - no frontend :(

crosswick commented 11 months ago

I am on the version that was installed automatically by copy-pasting the docker-compose.yml text from the site today.

andzejsp commented 11 months ago

I am on the version that was installed automatically by copy-pasting the docker-compose.yml text from the site today.

when you open manager page it should show the version

image

crosswick commented 11 months ago

2.10.4

DartLazer commented 11 months ago

I have the same issue. But it only does this for one of my domains, not all of them.

When I try to test the server reachability I get another error nginx-proxy-manager-app-1 | [9/21/2023] [9:37:25 AM] [SSL ] › ℹ info Testing http challenge for hvcao.nl nginx-proxy-manager-app-1 | Uncaught SyntaxError: Unexpected end of JSON input

And this error on the UI Communication with the API failed, is NPM running correctly?

pr0nstache commented 10 months ago

I see... and you thought it might have to do with #2713 ?

I just tried the following: Go to ssl cert tab (stand alone cert tab in the main page), delete old cert, go to Hosts tab, edit your proxy host, in the ssl tab under that proxy host dont force ssl, and just request new ssl cert. this worked for me just now.

Was reading up on #2011 and #3121, the first one helped, havent treid the new PR docker image that is the second one.

Thanks for this! Same error for me as everyone else from the "SSL tab" but from the Hosts tab> ssl tab> request new... worked for me without error.

github-actions[bot] commented 2 months ago

Issue is now considered stale. If you want to keep it open, please comment :+1:

sgeerish commented 4 weeks ago

Happens if one of the proxy host destination is not reachable. Delete the unreachable host and you won't get the error.

dravorle commented 4 weeks ago

Happens if one of the proxy host destination is not reachable. Delete the unreachable host and you won't get the error.

Not sure if it also happens when that condition is true but back when I created this issue it happened on a blank install while creating a first certificate for a route from within the creation form of said route.

So there were no proxy hosts even active or created