After 'amplify push' error - The "path" argument must be one of type string...
See original GitHub issueDescription
After ‘amplify push’ can not ‘push’ again. Subsequent pushes fail with the error ‘The “path” argument must be one of type string, Buffer, or URL. Received type object’
Other commands (like ‘amplify function build’) also fail. Output of failure listed below.
To Reproduce I have project with with vue client, and rest apis
brian@nova:~/Documents/whoclean/repos/broom[skip-lambda-learn]$ amplify init
Note: It is recommended to run this command from the root of your app directory
You're initializing your project with a beta version of the CLI which supports multiple environments of your project
? Do you want to use an existing environment? Yes
? Choose the environment you would like to use: skiptest
Using default provider  awscloudformation
✔ Initialized provider successfully.
Initialized your environment successfully.
Your project has been successfully initialized and connected to the cloud!
#removed output for brevity
brian@nova:~/Documents/whoclean/repos/broom[skip-lambda-learn]$ amplify push
Current Environment: skiptest
| Category | Resource name    | Operation | Provider plugin   |
| -------- | ---------------- | --------- | ----------------- |
| Function | dbpatch          | Update    | awscloudformation |
| Function | ApiXbroomdev     | No Change | awscloudformation |
| Function | users            | No Change | awscloudformation |
| Api      | ApiX             | No Change | awscloudformation |
| Api      | users            | No Change | awscloudformation |
| Api      | dbpatch          | No Change | awscloudformation |
| Auth     | broomtestcognito | No Change | awscloudformation |
| Hosting  | S3AndCloudFront  | No Change | awscloudformation |
? Are you sure you want to continue? Yes
⠼ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE    apiusers               AWS::CloudFormation::Stack Tue Jan 08 2019 12:11:27 GMT-
#removed output for brevity
UPDATE_COMPLETE functiondbpatch      AWS::CloudFormation::Stack Tue Jan 08 2019 12:11:54 GMT-0800 (Pacific Standard Time) 
✔ All resources are updated in the cloud
brian@nova:~/Documents/whoclean/repos/broom[skip-lambda-learn]$ amplify push
Current Environment: skiptest
| Category | Resource name    | Operation | Provider plugin   |
| -------- | ---------------- | --------- | ----------------- |
| Function | dbpatch          | Update    | awscloudformation |
| Function | ApiXbroomdev     | No Change | awscloudformation |
| Function | users            | No Change | awscloudformation |
| Api      | ApiX             | No Change | awscloudformation |
| Api      | users            | No Change | awscloudformation |
| Api      | dbpatch          | No Change | awscloudformation |
| Auth     | broomtestcognito | No Change | awscloudformation |
| Hosting  | S3AndCloudFront  | No Change | awscloudformation |
? Are you sure you want to continue? Yes
The "path" argument must be one of type string, Buffer, or URL. Received type object
This if then I try to build a function:
brian@nova:~/Documents/whoclean/repos/broom[skip-lambda-learn]$ amplify function build 
? Are you sure you want to continue building the resources? Yes
⠸ Building resources. This may take a few minutes...TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type object
    at Object.statSync (fs.js:862:3)
    at isPackageOutdated (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:69:26)
    at buildResource (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:36:5)
    at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:12:24)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
✖ An error occurred when building the resources.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type object
    at Object.statSync (fs.js:862:3)
    at isPackageOutdated (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:69:26)
    at buildResource (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:36:5)
    at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:12:24)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
There was an error building the function resources
Expected behavior
Expect push and build to succeed.
Research
If I diff the trees between what works and what does not work. The only non trivial diffs are in the amplify/backend/amplify-meta.json file.
subsequent to push each resouce has a section like
        "providerMetadata": {
          "s3TemplateURL": "https://s3.amazonaws.com/broom-20190106133834-deployment/amplify-cfn-templates/auth/broomtestcognito-cloudformation-template.yml",
          "logicalId": "authbroomtestcognito"
        }
If I swap out the amplify-meta.json with the pre push file, everything works again until the next push.
Versions
- OS: osx 10.14.2
 - Browser chrome
 
brian@nova:~/Documents/whoclean/repos$ amplify --version
0.2.1-multienv.20
Issue Analytics
- State:
 - Created 5 years ago
 - Reactions:2
 - Comments:10 (4 by maintainers)
 
Top Results From Across the Web
The "path" argument must be of type string ... - Stack Overflow
I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get...
Read more >body must be a string. received: undefined. - You.com | The search ...
Serverless Offline: The "path" argument must be of type string. Received undefined ... I have pushed the following schema.graphql file with amplify push...
Read more >Resolve template validation or template format errors in ...
Validate parameter definitions. 1. Set Type to one of the following supported properties: String, Number, List , or CommaDelimitedList; AWS- ...
Read more >amplify-js
log: string = `Error: Amplify has not been configured correctly.The configuration object is missing required auth properties.This error is typically caused by ...
Read more >API (GraphQL) - Client code generation - AWS Amplify Docs
Codegen add workflow triggers automatically when an AppSync API is pushed to the ... type Post @model { id: ID! title: String! blog:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just merged the fix for this as a part of #749. It’s in the pipeline and shoud be deployed soon as a part of 0.2.1-multienv.35.
Here is the problem
The function getSourceFiles in @aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/build-resources.js returns and array of arrays in my case. an array for every subdir below AMPLIFY_PROJECT/amplify/backend/functions/FUNCTION/src.
To fix the problem at line 65.