Amplify-cli: Amplify env checkout not working

Created on 8 Dec 2020  Â·  11Comments  Â·  Source: aws-amplify/amplify-cli

Describe the bug
Since version 4.38.0 the amplify env checkout __env__ command is not working, downgrading to 4.37.1 works.
The error -

Could not initialize 'prod': The "path" argument must be of type string. Received an instance of Error

Amplify CLI Version
4.38.0

To Reproduce
While having multiple amplify environments, perform amplify env checkout __env__ to a different environment than the one you are in - receive error.

Expected behavior
Environment should switch with the env checkout command.

not-reproducable pending-response pending-triage platform

All 11 comments

I was about to post the very bug @idanlo . Thanks for reporting. I downgraded to a previous version and it worked again

Same thing is happening to me with amplify push, and amplify env pull --restore.

$ amplify push
✖ There was an error pulling the backend environment dev.
An error occurred during the push operation: The "path" argument must be of type string. Received an instance of Error
$ amplify env pull --restore
â ™ Fetching updates to backend environment: dev from the cloud.Could not initialize 'dev': The "path" argument must be of type string. Received an instance of Error
$ amplify --version
4.38.0

Only major change I've made to my Amplify setup is to import a Cognito User Pool and Identity Pool. I'll try downgrading to see if that helps.

Update: Same problem with @aws-amplify/[email protected]. I am able to push using @aws-amplify/[email protected].

I cannot delete or checkout an environment with the same error message. I also cannot open the admin ui for this environment in the Amplify console.
Amplify-CLI 4.38.0

Will this be resolved soon? Getting the same error using amplify init with an existing environment. Currently on 4.38.2

Could not initialize 'envname': The "path" argument must be of type string. Received an instance of Error

@idanlo @dwamianm @jcf @hanna-becker it seems to be related to the setup of the project as I was not able to reproduce it. Could you provide exact repro steps for this?

Can confirm this regression exists on the latest version 4.39.0 and this is causing our CI deployments to fail. Downgrading to 4.37.1 like @jcf mentioned above seems to make it go away.

Output from our Jenkins node is shown below (project name and profile name redacted):

+ amplify init --amplify '{"projectName":"<project name>","envName":"dev","defaultEditor":"code"}' --providers '{"awscloudformation":{"configLevel":"project","useProfile":true,"profileName":"<profile name>"}}' --yes

Note: It is recommended to run this command from the root of your app directory

- Initializing your environment: dev

Could not initialize 'dev': The "path" argument must be of type string. Received an instance of Error

script returned exit code 1

This problem is currently affecting every single one of the Amplify projects at work, and not just on the CI server (macOS Catalina) but also on my Windows 10 work machine. Unfortunately, I could not reliably reproduce the problem after a couple hours of investigation. It seems to be pretty random, amplify init and amplify push throw this error when they have worked perfectly fine a few days ago. And when I install older version then install latest version again, it starts working again. Also tried creating an Amplify project on my personal MacBook Pro (macOS Catalina) and it works perfectly fine on there, so I don't understand what can be causing this.

Is there any way we can enable verbose output? Looks like it's still an open ticket (#501) but I think this would be nice to have so I can figure out exactly what "path" is and why it messes up only sometimes.

update your npm version exc command line: sudo npm install -g npm
can fix "The "path" argument must be of type string. Received an instance of Error"

We started having this issue on one of our team member's mac recently. What fixed it for us was running amplify configure project again and verifying the configuration.
Turns out CLI wasn't able to find the AWS credentials in the system so we ended up updating the project level AWS profile and it started working again.

Is anyone still seeing this issue after upgrading to version 4.40.0?

@jhockett Yes, still seeing the issue, 3 minor updates and still nothing changed

Was this page helpful?
0 / 5 - 0 ratings