Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heroku pg:copy fails after a few starting copy logs #3146

Open
ken-brevio opened this issue Dec 11, 2024 · 9 comments
Open

heroku pg:copy fails after a few starting copy logs #3146

ken-brevio opened this issue Dec 11, 2024 · 9 comments

Comments

@ken-brevio
Copy link

ken-brevio commented Dec 11, 2024

Do you want to request a feature or report a bug?

Bug report.

We are running on the latest version. We use curl https://cli-assets.heroku.com/install-ubuntu.sh | sh to install the heroku cli.

What is the current behavior?

We use the heroku toolchain to set up feature environments for us through Github actions.

When we run

DEBUG=* HEROKU_DEBUG=1 HEROKU_DEBUG_HEADERS=1 heroku pg:copy ...

We get the following error message

Starting copy of DATABASE to DATABASE... ⣾
Starting copy of DATABASE to DATABASE... ⣽
2024-12-11T06:44:06.967Z http undefined
Starting copy of DATABASE to DATABASE... ⣻
TypeError: Cannot read properties of undefined (reading 'exitCode')
    at Copy.catch (/usr/lib/heroku/node_modules/@oclif/core/lib/command.js:226:52)
    at Copy._run (/usr/lib/heroku/node_modules/@oclif/core/lib/command.js:121:29)
    at async Config.runCommand (/usr/lib/heroku/node_modules/@oclif/core/lib/config/config.js:314:25)
    at async Object.run (/usr/lib/heroku/node_modules/@oclif/core/lib/main.js:89:16)
Starting copy of DATABASE to DATABASE... done
Error: Process completed with exit code 1.

It looks like an issue with oclif that you introduced in v10. This worked fine in v9.5.1

What is the expected behavior?

That the database command works.

@iriberri iriberri changed the title heroku pb:copy fails after a few starting copy logs heroku pg:copy fails after a few starting copy logs Dec 11, 2024
@iriberri
Copy link
Contributor

I was also able to reproduce this directly after updating my CLI version for one of my testing databases.

Starting copy of DATABASE to PUCE... ⣻
Starting copy of DATABASE to PUCE... ⣷
TypeError: Cannot read properties of undefined (reading 'exitCode')
    at Copy.catch (/opt/homebrew/Cellar/heroku/9.5.0/lib/client/10.0.0-b084308/node_modules/@oclif/core/lib/command.js:226:52)
    at Copy._run (/opt/homebrew/Cellar/heroku/9.5.0/lib/client/10.0.0-b084308/node_modules/@oclif/core/lib/command.js:121:29)
    at async Config.runCommand (/opt/homebrew/Cellar/heroku/9.5.0/lib/client/10.0.0-b084308/node_modules/@oclif/core/lib/config/config.js:314:25)
Starting copy of DATABASE to PUCE... done

$ heroku version
heroku/10.0.0 darwin-arm64 node-v20.17.0

@jlipponen
Copy link

jlipponen commented Dec 13, 2024

Same happening with us. Update to 10.0.0 started failing our pg:copy.

> heroku --version
heroku/10.0.0 linux-x64 node-v20.17.0

> DEBUG=* HEROKU_DEBUG=1 HEROKU_DEBUG_HEADERS=1 heroku pg:copy $databaseUrl $dbName --app $TARGET_APP_NAME --confirm $TARGET_APP_NAME
Starting copy of database <removed> on [<removed>.amazonaws.com:5432](http://<removed>/) to DATABASE... ⣽
2024-12-13T12:12:58.762Z http undefined
TypeError: Cannot read properties of undefined (reading 'exitCode')
    at Copy.catch (/usr/lib/heroku/node_modules/@oclif/core/lib/command.js:226:52)
    at Copy._run (/usr/lib/heroku/node_modules/@oclif/core/lib/command.js:121:29)
    at async Config.runCommand (/usr/lib/heroku/node_modules/@oclif/core/lib/config/config.js:314:25)
    at async Object.run (/usr/lib/heroku/node_modules/@oclif/core/lib/main.js:89:16)
Starting copy of database <removed> on [<removed>:5432](<removed>:5432/) to DATABASE... done

Looking now into how to install 9.5.1 in our pipeline..

Hopefully this gets attention soon.

@asbjorn-brevio
Copy link

@jlipponen Did you figure out how to install 9.5? Very interested in any workarounds since we're currently sitting on our hands until this gets fixed 😅

@jlipponen
Copy link

Hi @asbjorn-brevio ! We decided to wait and hope this gets fixed, as we can live without pg:copy for a while.

However, we did a bit more digging and came up with this magic to intall 9.5.1:

curl https://cli-assets.heroku.com/install-standalone.sh | sed 's#/channels/stable/heroku-#/versions/9.5.1/1aaf605/heroku-v9.5.1-1aaf605-#' | sh

This uses the install-standalone.sh script, but modifies it on the fly to fetch an the wanted tarball, as the unmodified version always fetches the latest release.

We came up with the required URL (https://cli-assets.heroku.com/versions/9.5.1/1aaf605/heroku-v9.5.1-1aaf605-linux-x64.tar.gz) by taking a look at their GitHub actions run's promote step for 9.5.1.

I hope this helps!

@asbjorn-brevio
Copy link

@jlipponen Thank you so much! 🤩 Will try this

@asbjorn-brevio
Copy link

I've reproduced this as far back as 9.3.0, so this looks to be unrelated to changes in version 10. Probably some new bug in the Heroku API that's manifesting in a weird way.

@jlipponen
Copy link

I've reproduced this as far back as 9.3.0, so this looks to be unrelated to changes in version 10. Probably some new bug in the Heroku API that's manifesting in a weird way.

Too bad :( For us, going back to 9.5.1 resolved the pg:copy failure I posted previously.

@asbjorn-brevio
Copy link

Nevermind! I forgot to also downgrade node to 18! With node 18 and heroku-cli 9.5.1 it does not crash

gaganawhad added a commit to gaganawhad/heroku-buildpack-cli that referenced this issue Dec 20, 2024
The latest version of Heroku CLI has a problem with reading the return code properly when running `pg:copy`. heroku/cli#3146. Support proposes using older version of CLI for now.
@k80bowman
Copy link
Contributor

Thank you all for your patience, it sounds like you have figured out a workaround. We are currently evaluating a potential fix for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants