Back
Todo
Continuing to look into the CORS error I'm getting when my frontend tries to make an API request to my backend; it seems my backend dokku app wasn't deployed for some reason; destroyed my existing go dokku app and recreated it and then struggled with an error for a while before realizing I had the same issue a few days ago and the solution was to run `dokku builder:set backend-app build-dir backend`; now getting an error saying the download for my specified version of Go is "unknown to the buildpack"; after much trial-and-error I realized the problem was that Dokku has a stupid error message that makes it sound like it has already automatically chosen a Go buildpack when in fact it has not. I was additionally getting confused because I was seeing Dokku installing Go and not realizing that was because of my +heroku instruction in my go.mod file rather than Dokku automatically using a Go buildpack. The solution was to specify a Go buildpack for my app with `dokku buildpacks:add <my-app> heroku/go`. Now getting a new error: "Failed to connect to database". Fixed it by switching my code to use the `DATABASE_URL` environment variable that Dokku creates for your code to connect to the db. My `git push dokku main` finally succeeded, but I'm still getting a CORS error. Eventually figured out it was because my Dokku app name was `whatdo-backend` when I had forgotten that that would also be the name of the subdomain, so I had to delete the app and recreate it with the name `api`. I also created a `/ping` health-check URL to help me debug this more quickly. I'm now getting a 521 error, I think maybe because Dokku is running on http and Cloudflare is reaching out via https?
See similar todos

No replies yet