ndom91/briefkasten

Error 500 After setting up with Docker

BobHassok opened this issue ยท 13 comments

Describe the bug

After following the install instructions for the Docker image, I get error 500 when I visit the URL.

https://i.imgur.com/hxnyD41.png

Reproduction

Every Time I Setup the Docker Image

System Info

Ubuntu 22.04

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Built:            Tue Oct 25 17:59:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.12
 runc:
  Version:          1.1.4
 docker-init:
  Version:          0.19.0

Used Package Manager

n/a

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
e-p-s commented

same for me

but its the coolest 500 i've ever see.

image

@BobHassok
How do i get this status page?

Docker logfile:
https://pastebin.com/wfbmA2Vs

You are not reading the instructions carefully
After the initial start, you still have to manually seed the database. This is most easily done through the app container (bk-app). Run docker exec -it bk-app /bin/bash to enter a terminal session inside the container. Then run pnpm db:push inside the container. This will push the database schema from prisma to the configured database.

e-p-s commented

Thanks for your reply. im pretty sure i've done it before. but perhaps it was a try before. so ive done it now (again), but sadly the "same" 500 error:

https://pastebin.com/NV6DUrGQ

Stop the docker and do a 'docker system prune -a', this will delete all unused volumes, networks etc and let it rebuild, try it once again. Also ensure that you either have Github or Google section filled in under '.env'., else there won't be any sign in for you which will result in the error you received.

You are not reading the instructions carefully
After the initial start, you still have to manually seed the database. This is most easily done through the app container (bk-app). Run docker exec -it bk-app /bin/bash to enter a terminal session inside the container. Then run pnpm db:push inside the container. This will push the database schema from prisma to the configured database.

I did run the seed command when I set it up.

Also ensure that you either have Github or Google section filled in under '.env'.

What does it want when it asks for the GitHub secret? None of this is explained in setup.

You are not reading the instructions carefully
After the initial start, you still have to manually seed the database. This is most easily done through the app container (bk-app). Run docker exec -it bk-app /bin/bash to enter a terminal session inside the container. Then run pnpm db:push inside the container. This will push the database schema from prisma to the configured database.

I did run the seed command when I set it up.

Also ensure that you either have Github or Google section filled in under '.env'.

What does it want when it asks for the GitHub secret? None of this is explained in setup.

Oauth, https://next-auth.js.org/providers

You are not reading the instructions carefully
After the initial start, you still have to manually seed the database. This is most easily done through the app container (bk-app). Run docker exec -it bk-app /bin/bash to enter a terminal session inside the container. Then run pnpm db:push inside the container. This will push the database schema from prisma to the configured database.

I did run the seed command when I set it up.

Also ensure that you either have Github or Google section filled in under '.env'.

What does it want when it asks for the GitHub secret? None of this is explained in setup.

Oauth, https://next-auth.js.org/providers

So when I give it my ID and the OAuth secret it now gives me the option to sign in with GitHub, however when I try to sign in GitHub just tells me it can't find the page.

You are not reading the instructions carefully
After the initial start, you still have to manually seed the database. This is most easily done through the app container (bk-app). Run docker exec -it bk-app /bin/bash to enter a terminal session inside the container. Then run pnpm db:push inside the container. This will push the database schema from prisma to the configured database.

I did run the seed command when I set it up.

Also ensure that you either have Github or Google section filled in under '.env'.

What does it want when it asks for the GitHub secret? None of this is explained in setup.

Oauth, https://next-auth.js.org/providers

So when I give it my ID and the OAuth secret it now gives me the option to sign in with GitHub, however when I try to sign in GitHub just tells me it can't find the page.

I can't spoon feed you forever, search the related issues, others have mentioned it before. Setup the callback URL on GitHub side.

You've been rather hostile ever since I posted, if you don't want to help anyone then you shouldn't be responding here.

I did setup the callback URL. As I understand it, Oauth only needs to be contactable from the app. Since I have absolutely no interest in exposing briefkasten to the public, then my private URL should be fine. However the callback URL can't make connection.

Yeah so these seem to be next-auth related setup errors. See https://next-auth.js.org/getting-started/example for example

What's your setup like, are you running it via docker?
Did you set the NEXTAUTH_URL and NEXTAUTH_SECRET env variables?
If so, whats the NEXTAUTH_URL set to? Is it the same public FQDN that your app is available under?

Just a side note for people behind a reverse proxy, you need to use NEXTAUTH_URL_INTERNAL env var.
This took me some time to find, so I leave it here, hope it helps !

NEXTAUTH_URL=https://briefkasten.DOMAIN.TLD
NEXTAUTH_URL_INTERNAL=http://localhost:3000

see https://unix.stackexchange.com/questions/727162/how-can-i-configure-nextauth-behind-nginx-in-a-local-environment

Good point @FabriceBoyer, this is required if the server doesn't have access to the FQDN (i.e. potentially in a docker local setup where you're proxying it out where else for the client)

https://authjs.dev/reference/configuration/env#nextauth_url_internal

ndom91 commented

Closing this issue. This is an issue with NextAuth which should be handled by setting NEXTAUTH_URL_INTERNAL if behind a reverse proxy and having issues ๐Ÿ‘