Trying to redeploy to an EC2 instance on AWS, can't run shopify cli

I am trying to deploy my app on an ec2 instance, so I am doing the first step, which is to get the env vars, e.g.,

shopify "app" "env" "show"

The shopify cli is trying to open a link to shopify and it timesout. with

Auto-open timed out. Open the login page: Log in to Shopify Partners (URL)

I copy the url, paste it into my browser and of course it fails. So, then I copy the url, <copied-localhost-url> that it tried to go to and goto my ec2 instance and in another shell, I do wget <copied-localhost-url> Then, it reports an error:

╭─ error ───────────────────────────────────────────────────────────────────────────────────╮
│ │
│ The authentication can't continue because the redirect doesn't include the state. │
│ │
│ To investigate the issue, examine this stack trace: │
│ at (@shopify/cli-kit/src/session/redirect-listener.ts:91) │
│ const err = new Bug(MissingStateString) │
│ at (home/ec2-user/path-to-my-app-where-I-ran-the-original-command/node_modules/h3/dist/in │
│ dex.mjs:592) │
│ at nodeHandler (h3/dist/index.mjs:538) │
│ await handler(event); │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────╯

Any thoughts?

I figured this out by enclosing the URL string in quotes. Otherwise curl or wget mysteriously only sends partial URL. Hope that helps