amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

received this error while pulling (with --restore) `spawn xdg-open ENOENT`

Open marcorossiIT opened this issue 4 years ago • 6 comments

Before opening, please confirm:

  • [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

16.17.1

Amplify CLI Version

10.2.3

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

tried deleting DynamoDB table, but should be unrelated

Amplify Categories

Not applicable

Amplify Commands

pull

Describe the bug

during an amplify pull --restore, after choosing Amplify Studio to log, i clicked to open the browser tab as always visual studio code asks me to do but received CANNOT GET \, so i returned to the terminal and found the error 🛑 spawn xdg-open ENOENT and asking me to report here.

Expected behavior

The 🛑 spawn xdg-open ENOENT should not be shown.

Reproduction steps

  1. have a project with amplify
  2. have amplify studio login enabled
  3. perform action from visual studio code
  4. perform actions while in a working devcontainer
  5. pull from backend with amplify pull --restore
  6. open the browser from the shown notification by visual studio code
  7. returning to the terminal you find the error

GraphQL schema(s)

No response

Project Identifier

05da5437891348a191421c6eb46a0084

Log output

# Put your logs below this line


2022-10-13T14:44:08.007Z|info : amplify push core  {"yes":true}
2022-10-13T14:44:08.051Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2022-10-13T14:45:51.276Z|info : amplify push core  {"yes":true}
2022-10-13T14:45:51.317Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2022-10-13T14:49:49.644Z|info : amplify push core  {"yes":true}
2022-10-13T14:49:49.688Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2022-10-13T14:56:10.935Z|info : amplify pull core  {"restore":true,"yes":false}
2022-10-13T14:56:10.973Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2022-10-13T15:00:59.101Z|info : amplify version core  {"version":true,"yes":false}
2022-10-13T15:07:55.633Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2022-10-13T15:07:55.67

Additional information

this is the terminal showing the error short after selecting Amplify studio to login, idk if it's related to other actions of mine. if removed sensitive info.

Pulling changes from the cloud will override your local changes.
? Are you sure you would like to continue? Yes
? Select the authentication method you want to use: Amplify Studio
⠹ Fetching updates to backend environment: dev from the cloud.Opening link: https://-url-/verify/?loginVersion=1
⠋ Confirm login in the browser or manually paste in your CLI login key:
🛑 spawn xdg-open ENOENT

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
⠹ Confirm login in the browser or manually paste in your CLI login key:

✅ Report saved: /tmp/-path-.zip
⠏ Confirm login in the browser or manually paste in your CLI login key:
✔ Done

Project Identifier: 05da5437891348a191421c6eb46a0084
⠧ Confirm login in the browser or manually paste in your CLI login key:

marcorossiIT avatar Oct 13 '22 15:10 marcorossiIT

Hey @marcorossiIT :wave: thanks for raising this! To clarify, what do you mean by devcontainer

perform actions while in a working devcontainer

josefaidt avatar Oct 14 '22 20:10 josefaidt

This is a link to an official explanation of visual studio code dev containers. I've been using it for a while now. It's a way of using docker containers to replicate a fixed environment with tools and settings ready for development. I've been using one of Microsoft's proposed ones with alpine, nodejs, and some tools I use everyday.

marcorossiIT avatar Oct 14 '22 20:10 marcorossiIT

Hey @marcorossiIT thanks for clarifying! Would you mind providing a minimal .devcontainer.json showcasing the config and how the CLI is installed?

josefaidt avatar Oct 14 '22 21:10 josefaidt

I have this same problem using Github’s default devcontainer.json. I’ve worked around this problem by using a bash script as specified in the headless mode section of the docs. This allows me to pull my Amplify project without having to deal with interactive CLI prompts and Amplify Studio authentication.

As an aside, the authentication flow with Amplify Studio assumes that your amplify pull command, listening on 4242, is accessible via localhost, but when running through Github’s codespace Amplify Studio isn’t able to send credentials from your local browser into the Amplify web server

andrewtamura avatar Oct 20 '22 00:10 andrewtamura

Hey @marcorossiIT thanks for clarifying! Would you mind providing a minimal .devcontainer.json showcasing the config and how the CLI is installed?

sorry for late response, following there is a minimal devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/typescript-node
{
	"name": "Node.js & TypeScript",
	"build": {
		"dockerfile": "Dockerfile",
		// Update 'VARIANT' to pick a Node version: 18, 16, 14.
		// Append -bullseye or -buster to pin to an OS version.
		// Use -bullseye variants on local on arm64/Apple Silicon.
		"args": {
			"VARIANT": "16-bullseye"
		}
	},
	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"ms-python.vscode-pylance",
				"amazonwebservices.aws-toolkit-vscode",
				"GraphQL.vscode-graphql",
				"ms-python.python",
			]
		}
	},
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],
	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "yarn install",
	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "node",
	"features": {
		"git": "latest",
		"aws-cli": "latest",
		"python": "3.8"
	}
}

Unfortunately (or fortunately) i haven't recently experienced such an error anymore, neither i understand what could have been causing it. I don't have problems logging in right now.
I may have solved this issue by completely removing the directory in which the amplify directory itself was, and recreating everything locally via amplify pull --id <> --env <>.
It ain't much but i hope this will help someone.


I have this same problem using Github’s default devcontainer.json. I’ve worked around this problem by using a bash script as specified in the headless mode section of the docs. This allows me to pull my Amplify project without having to deal with interactive CLI prompts and Amplify Studio authentication.

As an aside, the authentication flow with Amplify Studio assumes that your amplify pull command, listening on 4242, is accessible via localhost, but when running through Github’s codespace Amplify Studio isn’t able to send credentials from your local browser into the Amplify web server

I'll keep an eye on this because i'm soon gonna start use the headless mode, thanks.

marcorossiIT avatar Oct 21 '22 11:10 marcorossiIT

Hey @marcorossiIT, the issue appears to be similar to https://github.com/aws-amplify/amplify-cli/issues/11240. the The comment https://github.com/aws-amplify/amplify-cli/issues/11240#issuecomment-1290866207 highlights a workaround. Please feel free in subscribing to the issue for any updates.

ykethan avatar Oct 27 '22 16:10 ykethan