Does "SAM Local Invoke" support EFS?

613 views Asked by At

I'm using Lambda to access EFS as described at https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html

The lambda function works fine when running in AWS, but it fails when using SAM with the "local invoke" command. The error is

2020-10-02T20:03:19.389Z        09b6f1b2-d80a-15e1-9531-f74182e95c1e    ERROR   Invoke Error    
{
   "errorType":"Error",
   "errorMessage":"ENOENT: no such file or directory, open '/mnt/efs/newfile.txt'",
   "code":"ENOENT",
   "errno":-2,
   "syscall":"open",
   "path":"/mnt/efs/newfile.txt",
   "stack":[
      "Error: ENOENT: no such file or directory, open '/mnt/efs/newfile.txt'",
      "    at Object.openSync (fs.js:458:3)",
      "    at Object.writeFileSync (fs.js:1355:35)",
      "    at WriteFile (/var/task/src/apis/permissions/isallowed.js:70:8)",
      "    at IsAllowedInPolicy (/var/task/src/apis/permissions/isallowed.js:52:5)",
      "    at Runtime.exports.handler (/var/task/src/apis/permissions/isallowed.js:16:28)",
      "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
   ]
}

Is "sam local invoke" supposed to work with EFS?

1

There are 1 answers

0
N R On BEST ANSWER

The answer is no.

I opened a support ticket with AWS and was told

This is a limitation on the AWS SAM CLI and not your configuration. Therefore, I have taken the initiative to submit an internal feature request with our internal service team(specifically AWS SAM CLI service team) on your behalf and I have added your company name and voice to this request. At the moment, we would not be able to provide an estimate on if or when this feature will be supported. I would advise to check the AWS announcement page from time to time for future service updates. https://aws.amazon.com/new/

I also discovered that someone submitted a feature request on GitHub as a workaround.