alexyakunin/BoardGames

[BUG] Unhandled exception. Npgsql.NpgsqlException (0x80004005): Exception while connecting

rogerfan03 opened this issue · 8 comments

What I did to try and fix this:
Edited app_release's settings to be like this
docker_out.log

    ports:
     - "8080:8080"
    environment:
      ASPNETCORE_URLS: "http://*:8080"
      HTTPS_PORT: 4430

docker compose down && docker compose up --build app_release

I checked via sudo lsof -i -P -n | grep :5432, sudo lsof -i -P -n | grep :8080 and sudo lsof -i -P -n | grep :4430 that the ports are not already in use.

The full log is attached.
FYI: I'm running this on an Quasi-Ubuntu VM (Pop OS Virtualbox), docker by itself seems to work, tested by successful run of docker run hello-world.
The same exact issue also occurs when trying to run app_debug instead of app_release.

Looking into this, yep, definitely an issue.

@rogerfan03 must be fixed now :)

@alexyakunin It's definitely improved a good bit, I am indeed now able to startup the application.
However I'm still unable to actually do much with it because there's a new error.
I've attached the log from docker-compose up --build app_debug below.
dout_log.txt

I'm not sure if there's any more information printed out in the browser page compared to the docker log, if you want/need any more output please simply write me a reply.

Looks like it's a weird issue: https://stackoverflow.com/questions/50843706/data-protection-in-asp-net-core-2-1-only-works-on-one-machine

Interestingly, the certificate is simply hard-coded in this case, but the topic starter wrote he saw the same error even when he was loading the cert. from file manually.

Could you try to remove .DisableAutomaticKeyGeneration() call on https://github.com/alexyakunin/BoardGames/blob/main/src/Host/Startup.cs#L139 , rebuild the docker containers & run it?

And if it doesn't help, also remove .ProtectKeysWithCertificate(dpCert) - this should definitely solve the problem.

Interestingly, this issue doesn't happen on K8S and my local WSL2-based Docker...

Let me know which of these options work - I'll make it default than... A custom cert. is used to make sure every machine in the cluster is able to encrypt/decrypt auth cookies, so nothing bad will happen if you don't do this while running the service on the same machine.

@alexyakunin I commented out line 139 and moved up the ; as you've asked and after that I ran docker-compose up --build app_release and it seems to have worked, I was now able to open it and login with my github in http, not https, https leads to an error Error code: SSL_ERROR_RX_RECORD_TOO_LONG.

But all in all I think it seems good. Thanks for the help and thanks for making this.