Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Lambda Timeout for local run #510

Closed
awschristou opened this issue Apr 26, 2019 · 7 comments
Closed

Configure Lambda Timeout for local run #510

awschristou opened this issue Apr 26, 2019 · 7 comments
Assignees
Labels
feature-request New feature or enhancement. May require GitHub community feedback. ux user experience

Comments

@awschristou
Copy link
Contributor

awschristou commented Apr 26, 2019

You can configure a Lambda Function's timeout in the SAM template, but you cannot configure it during local iteration. It should be possible to specify a different timeout configuration without changing the template file directly.

Lambda Function's Timeout is configurable via SAM Template, but is not honored in local run/debug sessions.

This should apply to run only. Hitting breakpoints during debug increases the likelihood of exceeding the timeout, which wouldn't make sense.

Reference: Template Spec

@awschristou awschristou added the feature-request New feature or enhancement. May require GitHub community feedback. label Apr 26, 2019
@bryceitoc9
Copy link
Contributor

Looks like debug is already configured by SAM to ignore this. The following code will time out after 3 seconds on a normal run but will succeed on a debug (even without breakpoints):

let response;
exports.lambdaHandler = async (event, context) => {
    try {
        response = {
            'statusCode': 200,
            'body': JSON.stringify({
                message: 'hello world',
            })
        }
    } catch (err) {
        console.log(err);
        return err;
    }
    await new Promise((resolve, reject) => {
        setTimeout(() => {resolve()}, 10000);
    });
    return response
};

@bryceitoc9
Copy link
Contributor

FYI, current iteration also doesn't pick up the value specified in the templates.yaml file. Do we want to implement this to pick up the template.yaml value, a specified override value in the ./.aws/templates.json file, or both?

@awschristou
Copy link
Contributor Author

I think it should take the template.yaml value when it can find one, and it should be possible to override this in the lambda configuration (in templates.json)

@maqen
Copy link

maqen commented May 7, 2019

I second this, unusable doing local invocation when using with slow external APIs in function

@mpiroc mpiroc added the ux user experience label May 9, 2019
@mpiroc mpiroc changed the title Configure timeout for Local SAM Run Configure Lambda Timeout for local run May 9, 2019
@danvasem
Copy link

this is going to be in a next release?? It's pointless to limit local execution to just 3 seconds.

@awschristou awschristou self-assigned this Jun 19, 2019
@awschristou
Copy link
Contributor Author

Issue has been revised to accept the configuration from the SAM Template.
A change is currently in review.

@awschristou
Copy link
Contributor Author

This change is now in the develop branch.
Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or enhancement. May require GitHub community feedback. ux user experience
Projects
None yet
Development

No branches or pull requests

5 participants