agata-anastazja

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

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

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

chgeuer

Perfect, glad you found it… I can’t delete or edit my reply above, unfortunately…

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43657 311
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

We're in Beta

About us Mission Statement