Hello & thank you for the Serverless Framework...
# help
s
Hello & thank you for the Serverless Framework (I'm a big fan). I'm running sst in a development mode. Following lambda code outputs a folder structure from my OS. I would expect to see a lambda execution environment folder structure.
Copy code
import {APIGatewayProxyEventV2, APIGatewayProxyHandlerV2} from "aws-lambda";
import * as fs from 'fs'

export const handler: APIGatewayProxyHandlerV2 = async (event: APIGatewayProxyEventV2) => {

    fs.readdirSync("/").forEach(file => {
        console.log(file);
    });

    return {
        statusCode: 200,
        headers: {"Content-Type": "text/plain"},
        body: `Response: ${JSON.stringify({})}`,
    };
};
I come across this when trying to use EFS in the lambda code. Attached code list my OS folder structure.  Any hints?
t
Yeah this one is tricky. The code is executing locally so it won't have access to the efs mount
That is one of the limitations with our model. You can always mark certain functions not to execute locally
s
thank you, where I can find more details how to mark function to not to execute locally ?
r
t
You can set this variable to false on your function: https://docs.serverless-stack.com/constructs/Function#enablelivedev
r
Hadn't spotted that one, @thdxr, nice
t
Recently added
s
ok that is interesting, thank you @thdxr and @Ross Coundon
f
@thdxr I think it might be possible to support EFS for live lambda dev? https://docs.aws.amazon.com/efs/latest/ug/efs-onpremises.html
Hey @Slawomir Stec, just opened an issue for this https://github.com/serverless-stack/serverless-stack/issues/739. We might not get to this right away, but if it becomes a blocker for you. Let me know, and I will bump up the priority for this.
s
@Frank low priority for me at the moment, I've decided to use S3 instead. Happy to help to test #739 once is done.
f
Sounds good! Thanks @Slawomir Stec