amplify-cli: Failed to pull the backend. - ENOENT: no such file or directory, realpath

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • 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.14.2

Amplify CLI Version

7.6.25

What operating system are you using?

Windows 11

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

No manual changes made.

Amplify Categories

auth, storage, function, api

Amplify Commands

pull

Describe the bug

Project was previously worked on a different device. Setting this up on a new device for the first time created this issue.

The ENOENT error appears to involve a function lambda layer looking for the file/directory realpath in “function<layerName>\lib\nodejs\node_modules\browser-resolve\node_modules\resolve\test\pathfilter\deep_ref\node_modules\deep\deeper”. It appears the sub-directory “deep_ref” does not exist but the sub-directories after that do exist.

Deleting any files related to amplify does not solve the issue.

Expected behavior

Amplify should be able to pull the project environment without error, including for any lambda layers.

Reproduction steps

Not sure if this will be reproducible for others as it appears to involve a lambda layer issue.

  1. Using an existing backend with a lambda layer in the function category, pull an environment on a new device

GraphQL schema(s)

No response

Log output

Backend environment 'dev' found. Initializing...
Failed to pull the backend.
ENOENT: no such file or directory, realpath 'C:\...\amplify\.temp\#current-cloud-backend\function\<layerName>\lib\nodejs\node_modules\browser-resolve\node_modules\resolve\test\pathfilter\deep_ref\node_modules\deep\deeper'


Additional information

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Most upvoted comments

I’m also having this issue now.

PullBackendFault: Failed to pull the backend.
    at attachBackend (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\attach-backend.js:55:15)
    at async Object.run (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\commands\pull.js:64:9)
    at async Object.executeAmplifyCommand (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\index.js:194:9)
    at async executePluginModuleCommand (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\execution-manager.js:139:5)
    at async executeCommand (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\execution-manager.js:37:9)
    at async Object.run (C:\snapshot\amplify-cli\build\node_modules\@aws-amplify\cli-internal\lib\index.js:121:5)

ENOENT: no such file or directory, realpath 'C:\Users\windowsuser\Projects\XXXXXXXXXXX\packages\lib_package_name_xxxxxxxxx\amplify\.temp\#current-cloud-backend\function\apinameLayer1473473xxxxxxxxxxxxxxxxxxxxx\lib\nodejs\node_modules\@aws-crypto\ie11-detection\node_modules\tslib\test\validateModuleExportsMatchCommonJS'  
Error: ENOENT: no such file or directory, realpath 'C:\Users\windowsuser\Projects\XXXXXXXXXXX\packages\lib_package_name_xxxxxxxxx\amplify\.temp\#current-cloud-backend\function\apinameLayer1473473xxxxxxxxxxxxxxxxxxxxx\lib\nodejs\node_modules\@aws-crypto\ie11-detection\node_modules\tslib\test\validateModuleExportsMatchCommonJS'

Amplify version: 12.10.1 (latest)

Hey @iyz91 great callout on the Node issue. I will re-open this and mark this as a dependency issue