EACCES: permission denied, open '/var/task/handler.js'

Anybody have any ideas why this is happening with the aws nodejs basic example running ‘serverless invoke -f hello’?

{
“errorMessage”: “EACCES: permission denied, open ‘/var/task/handler.js’”,
“errorType”: “Error”,
“stackTrace”: [
“Object.fs.readFileSync (fs.js:397:15)”,
“Object.Module._extensions…js (module.js:415:20)”,
“Module.load (module.js:343:32)”,
“Function.Module._load (module.js:300:12)”,
“Module.require (module.js:353:17)”,
“require (internal/module.js:12:17)”
]
}

‘serverless deploy’ executes ok and I can see the function in the aws lamda console.

Running on Mint 18.1, serverless 1.9.0, node 6.10.1

Why would serverless be looking in /var/task (which doesn’t exist anyway) for handler.js?

The /var/task is where your code gets put in the Lambda container.

The error is suggesting there’s a permissions issue with the file, or perhaps the filename is different?
Do you have any funky restrictions on that file locally, that might be getting propagated via packaging? e.g. no read access.

Thanks Rowan, was indeed a permissions thing. Enjoying the chatbot course btw, need to downgrade serverless to 1.6.1 now :slight_smile:

1 Like