-
Notifications
You must be signed in to change notification settings - Fork 501
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
Chapter 5: Internal Server Error: Connection pool timed out on POST to /subscriptions #146
Comments
Can you try lowering the minimum application log level from |
Hi, thank you for the suggestion. I lowered the log level as suggested, and unfortunately I didn't find the problem. I'm not sure what the preferred way of sharing logs is, but I put logs from the app launch until the end of a /subscribe span in a pastebin. They are quite dense. As everything works in dev, I assume there must be something wrong with my config in prod, but I cannot see it. I have diverged from your code in the get_configuration function, as the merge function on Config is deprecated (in 0.12). I think I wrote it correctly using the now preferred ConfigBuilder, though. Other than that I don't think my code diverges from the book (up to the end of chapter 5). I've gone over the code many times to try to find the issue. Pastebin: https://pastebin.com/aV6CDmE4 (log level trace) |
I don't think that env variable prefixes work the same in 0.12 for |
Thank you for helping me troubleshoot. I should've tried changing get_configuration from the start. It was indeed the issue, I changed it and now everything works. I look forward to continuing with the book! |
fixed in 0.13 config::Environment::with_prefix("app")
.prefix_separator("_")
.separator("__") |
Hi. I enjoyed the book and learned a lot already, but I've had a lot of issues with deployment on Digital Ocean App Platform. My first issue was the Out Of Memory error, #71, which I resolved by building the image with a GA workflow and deploying with that image. I originally had some weird issues with deploying the DB, but I resolved it.
However, after successfully deploying the app with the DB, I get a 500 on post requests to /subscriptions. I've checked the env vars in the DO console as instructed here: https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/ ->
echo $<name-of-environment-variable>
, and they are correct and the same as the connection parameters of the database. I've searched through my code, compared it to the book code, the book repo code and some other peoples solutions.Locally everything is fine and tests pass. The issue seems to be with the connection to the DB in production, as the query fails with Connection pool timed out. The health check passes.
In the DO runtime logs I get the expected output in the app logs:
In the DO database runtime logs I see no output when sending the request.
My app spec: https://github.com/oddgrd/zero2prod/blob/main/spec.yml
My image builder workflow: https://github.com/oddgrd/zero2prod/blob/main/.github/workflows/push-image.yml
My configuration file: https://github.com/oddgrd/zero2prod/blob/main/src/configuration.rs
I assume the issue here is something simple I have missed or misunderstood, but I'd be grateful if someone could have a look. Great book, thanks!
The text was updated successfully, but these errors were encountered: