---
title: "Using Heroku Postgres From A Fly App"
description: "A Fly application can use Heroku Postgres without migrating the application itself, with Heroku hosting an add-on-only app that provides the database. The setup provisions a Hobby Dev Heroku Postgres database, retrieves its URI credentials, and passes DATABASE_URL to the Fly deployment as a secret. A Node REST API using Sequelize parses that URI with pg-connection-string, then supplies the database, user, password, and host while enabling SSL and setting rejectUnauthorized to false for Heroku’s certificate-chain issue. After fly deploy, the app connects externally to Postgres, but the Hobby plan limits it to 20 connections unless upgraded. The article presents Heroku’s US and Europe data-center choices as a way to keep the database relatively close while Fly places the application near users, and warns that credentials rotate periodically without notification."
---

# Using Heroku Postgres From A Fly App

[Fly.io](https://yomu.fyi/company/fly-io) · Sep 28, 2020

**Type:** Tutorial

## Summary

A Fly application can use Heroku Postgres without migrating the application itself, with Heroku hosting an add-on-only app that provides the database. The setup provisions a Hobby Dev Heroku Postgres database, retrieves its URI credentials, and passes DATABASE\_URL to the Fly deployment as a secret. A Node REST API using Sequelize parses that URI with pg-connection-string, then supplies the database, user, password, and host while enabling SSL and setting rejectUnauthorized to false for Heroku’s certificate-chain issue. After fly deploy, the app connects externally to Postgres, but the Hobby plan limits it to 20 connections unless upgraded. The article presents Heroku’s US and Europe data-center choices as a way to keep the database relatively close while Fly places the application near users, and warns that credentials rotate periodically without notification.

## Context

Applications do not need to migrate from Heroku to Fly to use Heroku-hosted databases. Heroku can provide Postgres through an app with no application code, and the article presents this as a database option for a native Fly application.

## Approach / What changed

Provision a Hobby Dev Heroku Postgres add-on, copy its URI from the database credentials, and store it as the Fly app’s DATABASE\_URL secret. A Node and Sequelize application parses the URI with pg-connection-string and configures PostgreSQL with SSL enabled and rejectUnauthorized set to false.

## Takeaways

- Heroku’s Hobby Dev Postgres plan provides a 1GB database capable of holding up to 10,000 rows in the example.
- External access to Heroku Postgres requires SSL; the Sequelize configuration also disables rejection of self-signed certificates in Heroku’s server certificate chain.
- Heroku rotates database credentials periodically and does not warn applications when they change; the database is also limited to 20 connections unless the plan is upgraded.

**Tags:** [Fly](https://yomu.fyi/topic/fly), [Heroku](https://yomu.fyi/topic/heroku), [Postgres](https://yomu.fyi/topic/postgres)

- Source: [Fly.io](https://fly.io/blog/using-heroku-postgres-from-a-fly-app)
- Source URL: https://fly.io/blog/using-heroku-postgres-from-a-fly-app
- Ingested by Yomu: 2026-09-02T11:59:06.086Z

[Read original post](https://fly.io/blog/using-heroku-postgres-from-a-fly-app)
