Registry / devops / heroku-pg

heroku-pg

JSON →
library2.9.0jsnpmunverified

Heroku CLI plugin for managing Heroku Postgres databases. Current stable version is 2.9.0, released in 2018. Provides commands for datastore operations like backups, maintenance, and connection management. A companion plugin to the Heroku CLI, not a standalone library. No recent updates; may be in maintenance mode.

npm install heroku-pg
INSTALL
IMPORT
SIG · HEROKU-PG
H
heroku-pg
devopsjavascriptv2.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pg
import pg from 'heroku-pg'
const pg = require('heroku-pg')
ESM default import; CJS require may not work in newer Node versions.
psql
import { psql } from 'heroku-pg'
Named export for psql shell access.
backups
import { backups } from 'heroku-pg'
Backup management commands.

Initializes the Heroku Postgres plugin with an authenticated Heroku client instance.

import pg from 'heroku-pg'; import Heroku from 'heroku-client'; const heroku = new Heroku({ token: process.env.HEROKU_API_KEY }); pg(heroku).then(() => console.log('Heroku Postgres plugin ready'));
Debug
Known issues
breakingBreaking change in v2: plugin now returns a function instead of an object.
fix
Call pg(heroku) instead of using pg.run()
affects: >=2.0.0
deprecatedDeprecated: use of heroku-cli-util is deprecated in favor of cli-ux.
fix
Migrate to cli-ux for output formatting.
affects: >=1.0.0
gotchaPackage requires a valid Heroku API token set in environment variable HEROKU_API_KEY.
fix
Set HEROKU_API_KEY or use heroku-cli-util to authenticate.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'heroku-pg'
Package not installed globally or not in node_modules.
fix
Run `npm install -g heroku-pg` or add to your project dependencies.
TypeError: pg is not a function
Importing the wrong export or not calling the default export.
fix
Use `import pg from 'heroku-pg'` and then call `pg(heroku)`.
Upgrade
Version history
2.9.0latest on npm
Audit
Dependencies
heroku-cli-utilrequiredRequired for CLI helper functions
cli-uxrequiredCommand output formatting and user interaction
Agent activity
6 hits · last 30 days
node
6
Resources
heroku-pg — npm install heroku-pg · libregistry