⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
When using compose on services that have explicit artifact packages, the command fails with ✖ Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Steps to reproduce:
Create two services, named service-a and service-b. I used the starter templates for both. Only add package.artifact to each service. Both services are the same, except for the service name.
3. Create a compose file for both services.
```yaml
services:
service-a:
path: service-a
service-b:
path: service-b
Try to run a compose command, e.g. serverless package. This fails with the message ✖ Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Note if the files really do no exist at all, e.g. by renaming handler.js files, there is a different error message: ✖ Cannot access package artifact at "index.js" (for "function1"): ENOENT: no such file or directory, access '/code/service-b/index.js'
Going into a service folder and trying to package a service individually (cd service-a; serverless package)
Context
Serverless ϟ Support
This generates a report from your last Serverless Framework command (including any errors) to use for Github Issues, debugging w/ AI, or creating a support ticket w/ Serverless Inc.
Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Error Stacktrace
at ReadStream.<anonymous> (file:///root/.serverless/releases/4.4.0/package/dist/sf-core.js:735:41032)
at ReadStream.emit (node:events:519:28)
at ReadStream.emit (node:domain:488:12)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Error Stacktrace
at ReadStream.<anonymous> (file:///root/.serverless/releases/4.4.0/package/dist/sf-core.js:735:41032)
at ReadStream.emit (node:events:519:28)
at ReadStream.emit (node:domain:488:12)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Issue description
When using compose on services that have explicit artifact packages, the command fails with
✖ Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Steps to reproduce:
service-a
andservice-b
. I used the starter templates for both. Only addpackage.artifact
to each service. Both services are the same, except for the service name.provider: name: aws runtime: nodejs18.x
functions: function1: handler: index.handler package: artifact: index.js
serverless package
. This fails with the message✖ Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Note if the files really do no exist at all, e.g. by renaming
handler.js
files, there is a different error message:✖ Cannot access package artifact at "index.js" (for "function1"): ENOENT: no such file or directory, access '/code/service-b/index.js'
Going into a service folder and trying to package a service individually (
cd service-a; serverless package
)Context
Serverless ϟ Support
This generates a report from your last Serverless Framework command (including any errors) to use for Github Issues, debugging w/ AI, or creating a support ticket w/ Serverless Inc.
Summary Report -----------------
Service Overview
Service Config
Service Overview
Error Message
Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Error Stacktrace
Service Config
Service Overview
Error Message
Error: Error: ENOENT: no such file or directory, open 'index.js' encountered during hash calculation for provided filePath: index.js
Error Stacktrace
Service Config
Service Overview
Above is a summary report of your last Serverless Framework command.
Use it to debug with AI (e.g. ChatGPT) or report a new Github Issue: https://slss.io/issue