Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 DatabaseError Forbidden when Self-Hosting #1072

Open
ash-development opened this issue Jul 16, 2024 · 8 comments
Open

403 DatabaseError Forbidden when Self-Hosting #1072

ash-development opened this issue Jul 16, 2024 · 8 comments

Comments

@ash-development
Copy link

ash-development commented Jul 16, 2024

i am currently trying to self-host Dub based off of this repo. i am running into the following errors:

 DatabaseError: Forbidden
    at (../../node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:145:0)
    at (../../node_modules/.pnpm/@[email protected]/node_modules/@planetscale/database/dist/index.js:81:0)
    at (lib/planetscale.ts:52:4)
    at (lib/middleware/link.ts:69:21)
    at (../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/esm/server/web/adapter.js:156:0) {
  status: 403,
  name: 'DatabaseError',
  body: { code: 'internal', message: 'Forbidden' }
}
[GET] [middleware: "middleware"] / reason=EDGE_FUNCTION_INVOCATION_FAILED, status=500, user_error=true

i have set up my mysql and planetscale proxy based off of this docker compose file and added them as environment variables in vercel as follows:

DATABASE_URL="mysql://root:@NODEIP:3307/planetscale"
PLANETSCALE_DATABASE_URL="http://root:unused@NODEIP:3900"

the only thing the build logs display as errors are what is below, although i doubt that it is directly related to the error. any help is appreciated, thank you!!

web:build: API error occurred Dynamic server usage: Route /api/analytics/demo couldn't be rendered statically because it accessed `request.headers`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
web:build:    Generating static pages (16/64) 
web:build: API error occurred Dynamic server usage: Route /api/me couldn't be rendered statically because it accessed `request.headers`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
web:build: API error occurred Dynamic server usage: Route /api/support/upload couldn't be rendered statically because it accessed `request.headers`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
web:build:    Generating static pages (48/64) 
Copy link

linear bot commented Jul 16, 2024

@ash-development
Copy link
Author

i'd also like to note that the database connects fine when ran with a local dev instance, it simply just fails when deploying in vercel.

this is the error that is displayed on the actual deployed page:
Screenshot 2024-07-16 at 8 49 18 AM

@h4MeMengoding
Copy link

hii @ash-development, have you found a way to fix it?

@ash-development
Copy link
Author

ash-development commented Jul 21, 2024

@h4MeMengoding nope 🤷🏼‍♀️ i just gave up because this was after two days straight of troubleshooting. wasn't THAT worth it to me lol. its very odd that the database works with a dev installation (still via remote SQL database) but not thru prod with hosting on vercel

it seems that support for self-hosting is pretty nonexistent unfortunately

@h4MeMengoding
Copy link

me too!, 2 weeks ago I tried to find the problem for 1 week in a row, and no results, it seems that dub prioritizes its users only using their web version, maybe

@steven-tey
Copy link
Collaborator

@ash-development what are you using for the MySQL proxy? Where is your MySQL DB hosted on? That could be the source of the error here

@jhuynh08
Copy link

I'm also seeing this same issue. Any luck on getting this to work?

@ash-development
Copy link
Author

@ash-development what are you using for the MySQL proxy? Where is your MySQL DB hosted on? That could be the source of the error here

using both of these via docker compose, had to change the ports as the originals are also running on my server lol
https://github.com/ash-development/my-dub/blob/main/apps/web/docker-compose.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants