caprover icon indicating copy to clipboard operation
caprover copied to clipboard

Useless error messages when testing one-click configurations

Open NeoTheThird opened this issue 5 years ago • 1 comments

When testing faulty one-click configs, the error messages are often useless.

The following config will yield this error (due to the port mapping on 80):

captainVersion: 4
services:
    $$cap_appname:
        image: alpine
        ports:
            - "80:1337"
caproverOneClickApp:
    instructions:
        start: |-
            This won't work and you won't know why
        end: |-
            See, what'd i tell ya
    displayName: Gah!
    isOfficial: true
    description: This'll error out
    documentation: https://nope

image

If you put in a really wonky config (such as the one below, note the absence of the caproverOneClickApp section), you'll just get a brief "Something bad happened" popup and then nothing. While that is hilarious, it's not very helpful.

captainVersion: 4
services:

Caprover could do some additional validation on the entered yml/json and display more useful error messages.

NeoTheThird avatar Oct 18 '20 20:10 NeoTheThird

CapRover does perform a validation on one-click apps, but not all errors can be caught by CapRover validation. In this case, the error is emitted by Docker because port 80 on the host is already taken, and you're trying to re-assign it. These types of errors are not known until you actually try and only then they will appear.

Relaying docker information back to the client is not the best practice. It can container very long logs and information that will be hard to digest in an error toast on web. Also, it is not a good practice in terms of security. Logs might contain sensitive information. For these reasons, only a handful of "expected" errors are chosen to be displayed to the user.

Having said all this, there is still some improvements that can be done. We should add to the error message information on how to troubleshoot the error further. i.e., read the logs of CapRover.

githubsaturn avatar Oct 19 '20 01:10 githubsaturn