Web Page does not load After Sign in
After I deploy the system using the docker compose example, i am unable to connect after logging in. The error is can't reach this page. In the docker container log I see this in the logs: The following migrations have been applied:
migrations/ └─ 20220129233509_/ └─ migration.sql └─ 20220130122101_/ └─ migration.sql └─ 20220130225732_/ └─ migration.sql
All migrations have been successfully applied. Done in 1.84s. yarn run v1.22.19 $ prisma generate Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (3.7.0 | library) to ./node_modules/@prisma/client in 188ms You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
warn Versions of [email protected] and @prisma/[email protected] don't match.
This might lead to unexpected behavior.
Please make sure they have the same version.
┌─────────────────────────────────────────────────────────┐
│ Update available 3.14.0 -> 4.3.1 │
│ │
│ This is a major update - please follow the guide at │
│ https://pris.ly/d/major-version-upgrade │
│ │
│ Run the following to update │
│ yarn add --dev prisma@latest │
│ yarn add @prisma/client@latest │
└─────────────────────────────────────────────────────────┘
Done in 3.35s.
yarn run v1.22.19
$ prisma db seed
Environment variables loaded from .env
Running seed command node prisma/seed.js ...
{
admin: {
id: 1,
createdAt: 2022-09-11T20:22:19.258Z,
updatedAt: 2022-09-11T20:22:19.258Z,
name: 'admin',
password: '$2b$10$BFmibvOW7FtY0soAAwujoO9y2tIyB7WEJ2HNq9O7zh9aeejMvRsKu',
email: '[email protected]',
isAdmin: true
},
internal: {
id: 1,
createdAt: 2022-09-11T20:22:19.264Z,
updatedAt: 2022-09-11T20:22:19.264Z,
name: 'internal',
email: '[email protected]',
contactName: 'admin',
number: '123456789',
notes: null
}
}
🌱 The seed command has been executed.
Done in 1.26s.
yarn run v1.22.19
$ next start
ready - started server on 0.0.0.0:5000, url: http://localhost:5000
info - Loaded env from /app/.env
warn - SWC minify beta enabled. https://nextjs.org/docs/messages/swc-minify-enabled
[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error request to http://peppermint.jwtsolutions.co/api/auth/csrf failed, reason: read ECONNRESET {
error: {
message: 'request to http://peppermint.jwtsolutions.co/api/auth/csrf failed, reason: read ECONNRESET',
stack: 'FetchError: request to http://peppermint.jwtsolutions.co/api/auth/csrf failed, reason: read ECONNRESET\n' +
' at ClientRequest.
I notice that the instructions say to go the base url which doesnt load. I added port 80 to the client container just to test it and it was still no go. however I can connect when I go to 'http://peppermint.jwtsolutions.co:5000/', I am prompted to log in but after that I am redirected to a page that does not load.
Any suggestions would be appreciated. Any suggestions would be appreciated.
can you post your docker compose file please
Thanks for getting back to me so quickly.
version: "3.1"
services: postgres: container_name: postgres image: postgres:latest restart: always volumes: - ./docker-data/db:/data/db environment: POSTGRES_USER: peppermint POSTGRES_PASSWORD: 1234 POSTGRES_DB: peppermint
client: container_name: peppermint image: pepperlabs/peppermint:latest ports: - 5000:5000 restart: on-failure depends_on: - postgres environment: PORT: 5000 DB_USERNAME: peppermint DB_PASSWORD: 1234 DB_HOST: 'postgres' BASE_URL: "http://peppermint.jwtsolutions.co"
Did we have any updates on this issue? I can provide more detail if needed.
UPDATE - I changed the bse url to peppermint (removing the jwtsolutions.co from the docker compose file) and redeployed the container and the error is slightly different:
yarn run v1.22.19 $ prisma migrate deploy Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "peppermint", schema "public" at "postgres:5432"
3 migrations found in prisma/migrations
No pending migrations to apply. Done in 2.22s. yarn run v1.22.19 $ prisma generate Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (3.7.0 | library) to ./node_modules/@prisma/client in 270ms You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
warn Versions of [email protected] and @prisma/[email protected] don't match.
This might lead to unexpected behavior.
Please make sure they have the same version.
┌─────────────────────────────────────────────────────────┐
│ Update available 3.14.0 -> 4.5.0 │
│ │
│ This is a major update - please follow the guide at │
│ https://pris.ly/d/major-version-upgrade │
│ │
│ Run the following to update │
│ yarn add --dev prisma@latest │
│ yarn add @prisma/client@latest │
└─────────────────────────────────────────────────────────┘
Done in 5.75s.
yarn run v1.22.19
$ prisma db seed
Environment variables loaded from .env
Running seed command node prisma/seed.js ...
{
admin: {
id: 1,
createdAt: 2022-09-11T22:34:35.429Z,
updatedAt: 2022-09-11T22:34:35.429Z,
name: 'admin',
password: '$2b$10$BFmibvOW7FtY0soAAwujoO9y2tIyB7WEJ2HNq9O7zh9aeejMvRsKu',
email: '[email protected]',
isAdmin: true
},
internal: {
id: 1,
createdAt: 2022-09-11T22:34:35.441Z,
updatedAt: 2022-09-11T22:34:35.441Z,
name: 'internal',
email: '[email protected]',
contactName: 'admin',
number: '123456789',
notes: null
}
}
🌱 The seed command has been executed.
Done in 1.71s.
yarn run v1.22.19
$ next start
ready - started server on 0.0.0.0:5000, url: http://localhost:5000
info - Loaded env from /app/.env
warn - SWC minify beta enabled. https://nextjs.org/docs/messages/swc-minify-enabled
[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error request to http://peppermint/api/auth/csrf failed, reason: connect ECONNREFUSED 172.19.0.3:80 {
error: {
message: 'request to http://peppermint/api/auth/csrf failed, reason: connect ECONNREFUSED 172.19.0.3:80',
stack: 'FetchError: request to http://peppermint/api/auth/csrf failed, reason: connect ECONNREFUSED 172.19.0.3:80\n' +
' at ClientRequest.
d
Did we have any updates on this issue? I can provide more detail if needed.
Did you ever set up a reverse proxy?
I use nginx proxy manager but I haven't set it up for this instance just yet. I wanted to get it working before implementing the reverse proxy.
You need to set up the reverse proxy, then will work on your sub directory, i have no issues
I am having a similar issue on a local network setup. Issue #114
--edit-- Please disregard. My issue was completely unrelated.
I know that this issue is old, but for anyone looking to resolve this in the future, the issue comes from the final line of the error.
},
message: 'request to http://peppermint/api/auth/csrf failed, reason: connect ECONNREFUSED 172.19.0.3:80'
}
Here you can see that the error is ECONNREFUSED 172.19.0.3:80, in the end users config the clients base URL is BASE_URL: "http://peppermint.jwtsolutions.co/". which is not 172.19.0.3:80. To resolve this issue quickly, set your base url to include the port as well.
The proper way to resolve it would be probably building a reverse proxy that would forward traffic from port 80 to the port 5000.
@ofgrenudo thank you for this
Will write some more docs around this
With the new backend api this should now no longer be an issue