`fly postgres import` failing with "cannot connect to target"

I’m seeing if I can upgrade my legacy fly postgres app to the a new postgres-flex one. The docs say to use fly postgres import which is what I’m trying.

So I created a new postgres cluster with fly ps create and verify it’s running and I can connect to it:

$ fly status -a matchhaus-pg                                                                                                                                                                                                       [11:38:31]
ID            	STATE  	ROLE   	REGION	CHECKS            	IMAGE                             	CREATED             	UPDATED
1851edb4e01398	started	primary	lhr   	3 total, 3 passing	flyio/postgres-flex:15.6 (v0.0.51)	2024-06-10T09:25:40Z	2024-06-10T09:25:51Z

Then attempt to import a db from my legacy cluster:

$ fly pg import postgres://postgres:<redacted>@matchhaus-db.internal:5432/matchhaus_staging -a matchhaus-pg --create                                                                         

? Choose a region to deploy the migration machine: London, United Kingdom (lhr)
? Select VM size: shared-cpu-1x - CPU Kind: Shared, vCPUs: 1 Memory: 256MB
Created an ephemeral machine 32871d1a154098 to run the import process.
Connecting to fdaa:0:3610:a7b:2809:2ecd:3346:2... complete
[info] Running pre-checks...
[error] failed to connect to target: failed to connect to `host=1851edb4e01398.vm.matchhaus-pg.internal user=postgres database=`: failed to receive message (unexpected EOF)
Waiting for ephemeral machine 32871d1a154098 to be destroyed ... done.
Error: failed to run ssh: ssh shell: Process exited with status 1 

As can be seen, the import fails, apparently due to the import process failing to connect to my target cluster (postgres-pg).

Why is this and how can I fix it? Presumably the import command somehow manages to authenticate itself with the target DB, but it’s not clear how this works.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.