<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: VidhiDixit2000</title>
    <description>The latest articles on DEV Community by VidhiDixit2000 (@vidhidixit2000).</description>
    <link>https://dev.to/vidhidixit2000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4096098%2Fa5a3a72a-c70c-46c0-a9d3-9c98c33f305e.png</url>
      <title>DEV Community: VidhiDixit2000</title>
      <link>https://dev.to/vidhidixit2000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vidhidixit2000"/>
    <language>en</language>
    <item>
      <title>My app could read the database. pgAdmin couldn't. Both were pointing at "localhost:5432"</title>
      <dc:creator>VidhiDixit2000</dc:creator>
      <pubDate>Thu, 27 Aug 2026 08:04:06 +0000</pubDate>
      <link>https://dev.to/vidhidixit2000/my-app-could-read-the-database-pgadmin-couldnt-both-were-pointing-at-localhost5432-59bo</link>
      <guid>https://dev.to/vidhidixit2000/my-app-could-read-the-database-pgadmin-couldnt-both-were-pointing-at-localhost5432-59bo</guid>
      <description>&lt;p&gt;I was running a FastAPI app in Docker with a PostgreSQL container next to it. The app worked. It wrote rows, it read them back, everything behaved.&lt;/p&gt;

&lt;p&gt;The database itself, &lt;code&gt;fastapi-db&lt;/code&gt;, was one I'd created inside the dockerised PostgreSQL — the container defined in my compose file. My app had created the &lt;code&gt;products&lt;/code&gt; table in it and was happily writing rows.&lt;/p&gt;

&lt;p&gt;Then I opened pgAdmin to look at that data directly, connected to &lt;code&gt;localhost:5432&lt;/code&gt;, and found nothing. No &lt;code&gt;fastapi-db&lt;/code&gt;. No &lt;code&gt;products&lt;/code&gt; table. Just &lt;code&gt;postgres&lt;/code&gt;, &lt;code&gt;template0&lt;/code&gt;, &lt;code&gt;template1&lt;/code&gt; — the default databases of an empty install.&lt;/p&gt;

&lt;p&gt;So my application was clearly talking to a database. pgAdmin was clearly talking to a database. They weren't the same database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I assumed first&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My first thought was that pgAdmin wasn't refreshing, or that Docker wasn't persisting anything. Both wrong, and both cost me time.&lt;/p&gt;

&lt;p&gt;The thing that actually settled it was running this in pgAdmin's query tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;version&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It came back with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PostgreSQL 18.4 on x86_64-windows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows. Not the Linux build that would be running inside a container. pgAdmin was connected to a PostgreSQL I'd installed on Windows months earlier and forgotten about — one that was running as a background service the whole time.&lt;/p&gt;

&lt;p&gt;To confirm who owned the port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;netstat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ano&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;findstr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;5432&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That returns the PID holding the port, and it belonged to the Windows PostgreSQL service. It had claimed &lt;code&gt;localhost:5432&lt;/code&gt; at boot, long before Docker was involved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The part I'd misunderstood&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's what I hadn't grasped: my app and pgAdmin were reaching the database over two completely different routes.&lt;/p&gt;

&lt;p&gt;Inside Docker Compose, containers reach each other by service name on the Docker network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fastapi-container  ───►  postgres-db:5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That never touches the host machine's ports at all. It's container-to-container, resolved by Docker's internal DNS. Which is why my app worked perfectly and gave me no hint anything was wrong.&lt;/p&gt;

&lt;p&gt;pgAdmin runs on Windows, outside Docker. It can only reach the container through a published port — the host-side mapping in the compose file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localhost:5432  ───►  (published port)  ───► container:5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And &lt;code&gt;localhost:5432&lt;/code&gt; on my machine was already spoken for.&lt;/p&gt;

&lt;p&gt;So one path was working fine and the other was quietly landing somewhere else entirely. Same port number in both places, two unrelated destinations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Change the host side of the mapping so it doesn't collide:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5433:5432"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two numbers do different jobs, and this is the bit worth internalising. The left one is the port on your machine. The right one is the port inside the container. Postgres inside the container is still listening on 5432 and doesn't need to change — only the door on the outside moves.&lt;/p&gt;

&lt;p&gt;Then a new pgAdmin connection to &lt;code&gt;localhost:5433&lt;/code&gt;, and &lt;code&gt;fastapi-db&lt;/code&gt; appeared immediately — the database I'd created inside the container, with the &lt;code&gt;products&lt;/code&gt; table and the same rows my app had been writing all along.&lt;/p&gt;

&lt;p&gt;My FastAPI config didn't change at all. It was still using &lt;code&gt;postgres-db:5432&lt;/code&gt;, because it was never going through the host in the first place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A smaller thing that had also confused me&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;pgAdmin's sidebar shows a tree called Servers, and I had two entries under it. I assumed that meant two PostgreSQL server processes.&lt;/p&gt;

&lt;p&gt;It doesn't. In pgAdmin, a "Server" is a saved connection profile — a stored host and port. Two entries means "I know how to reach two PostgreSQL servers," the same way two contacts in your phone don't mean two phones.&lt;/p&gt;

&lt;p&gt;That's why one of mine showed a red X. The server wasn't gone; pgAdmin just wasn't currently connected to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I'd tell past me&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a containerised app can see its database and your GUI client can't, don't start by suspecting your app. Ask which database each one is actually reaching. Two commands answer it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;version&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;netstat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ano&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;findstr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;5432&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first tells you what you're connected to. The second tells you who owns the port.&lt;/p&gt;

&lt;p&gt;And the general lesson, which took me longer than it should have: inside Docker and outside Docker are two different networks. Containers reach each other by service name and never touch your host's ports. Everything else — your GUI client, your browser, curl — can only get in through a published port, and that port is competing with every other thing installed on your machine.&lt;/p&gt;

&lt;p&gt;Same number, different world.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>postgres</category>
      <category>devops</category>
      <category>fastapi</category>
    </item>
    <item>
      <title>The import that worked for months and broke on my first deploy</title>
      <dc:creator>VidhiDixit2000</dc:creator>
      <pubDate>Wed, 26 Aug 2026 19:40:00 +0000</pubDate>
      <link>https://dev.to/vidhidixit2000/the-import-that-worked-for-months-and-broke-on-my-first-deploy-5a3l</link>
      <guid>https://dev.to/vidhidixit2000/the-import-that-worked-for-months-and-broke-on-my-first-deploy-5a3l</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Could not resolve "../styles/Randomfacts.css" from "src/pages/Randomfacts.tsx"
Error: Command "npm run build" exited with 1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was my first deploy to Vercel, and my first thought was that I'd broken something in that commit.&lt;/p&gt;

&lt;p&gt;I opened Randomfacts.tsx and found it importing Randomfacts.css — capital R. Then I checked the actual file sitting in src/styles/, and its name was randomfacts.css, lowercase.&lt;/p&gt;

&lt;p&gt;So the import was wrong. Fine. But that raised a much more confusing question:&lt;/p&gt;

&lt;p&gt;Why had npm run build never thrown this error on my machine?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The actual cause&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Windows filesystems are case-insensitive. Ask for Randomfacts.css when the file is called randomfacts.css and Windows hands it over without comment. Both spellings resolve to the same file, so the mismatched import worked locally for months.&lt;/p&gt;

&lt;p&gt;Vercel builds on Linux, which compares filenames byte for byte. There, R and r are genuinely different names — and the one my import asked for didn't exist.&lt;/p&gt;

&lt;p&gt;Same code, same import, two different answers. The operating system answered, not the bundler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I matched the import to the real filename. Then a Windows wrinkle worth knowing: a case-only rename won't be recorded by git, so if you rename the file instead of the import, it takes two steps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nb"&gt;mv &lt;/span&gt;src/styles/randomfacts.css src/styles/temp.css
git &lt;span class="nb"&gt;mv &lt;/span&gt;src/styles/temp.css src/styles/Randomfacts.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How to catch these before the build does&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use git ls-files rather than ls. It shows the name git actually recorded, which is what the build server checks out — your local filesystem will happily lie to you here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git ls-files src/styles/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare that output against your imports. Any casing mismatch is a build failure waiting for your next deploy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took from it&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There's a whole class of bugs that only exist when your deploy environment differs from your development one. Case sensitivity is the most common. Path separators and missing environment variables are close behind. None of them are visible while you're only running things locally, and none have anything to do with your logic being wrong.&lt;/p&gt;

&lt;p&gt;I'd been building this project on and off for months — adding functionality in bursts, brushing up on different concepts along the way — and only hit this on the first deploy. It would have taken ten seconds to spot if I'd deployed at the start.&lt;/p&gt;

&lt;p&gt;That's the real lesson for me. Deploy early, even when the project isn't finished. Not for the URL, but because the deploy environment finds a category of bug that your machine structurally cannot.&lt;/p&gt;

</description>
      <category>react</category>
      <category>linux</category>
      <category>git</category>
      <category>vercel</category>
    </item>
  </channel>
</rss>
