agata-anastazja
Azure app service claims non-existing domain - but it works on my machine
Hello!
I am setting up a phoenix app and want to deploy it on Azure app service.
I run the docker image locally, and can connect to the Azure postgres app.
When I use the same image for app deployment I get this error
2025-02-01T21:23:27.0698211Z 21:23:27.069 [error] Postgrex.Protocol (#PID<0.2973.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (company-name-staging.postgres.database.azure.com:5432): non-existing domain - :nxdomain
config:
config :company-name, App.Repo,
ssl: true,
ssl_opts: [
stacktrace: true,
protocol: :tls,
protocol_version: :"tlsv1.3",
verify: :verify_peer,
cacertfile: "/etc/ssl/certs/ca-certificates.crt",
server_name_indication: String.to_charlist(pghostname),
verify_fun:
{&:ssl_verify_hostname.verify_fun/3,
[check_hostname: String.to_charlist(pghostname)]}
],
database: pgdatabase,
username: pgusername,
password: pgpassword,
hostname: pghostname,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
bonus weirdness:
in my start up script I run
psql "host=<hostname>.database.azure.com port=5432 dbname=postgres user=admin password=$PGPASSWORD" -c "SELECT * FROM users;"
and I can connect to the db even from deployed app
the database’s authentication method is PostgreSQL user and password only
Most Liked
chgeuer
Is the hostname you have configured vitvio-staging.postgres.database.azure.com:5432? Like with the port number? When it says vitvio-staging.postgres.database.azure.com:5432: non-existing domain, that certainly makes sense, because the domain would just be vitvio-staging.postgres.database.azure.com. Maybe you should do
hostname: "vitvio-staging.postgres.database.azure.com",
port: 5432
chgeuer
I initially thought you might have a problem that there’s a VNET that has another PostgreSQL included via private endpoint, but that seems not to be the case.
I see you’re already having a support ticket open from Friday, I’d say let’s give them a change to dig deeper. Feel free to include me in your mails with support (mailto:chgeuer@…)
One question: You say in your “start up script” you can run psql and connect to the host, but then your Elixir app can’t, do I understand this right? Are both the startup script and the BEAM instance run in the same docker container?
BTW, I see you redacted the hostname in your original post, after I cited it in my reply above. Let me know whether I should delete my reply.
chgeuer
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









