A cross-functional and emotionally intelligent executive leader and Army veteran with over 20 years of proven expertise in driving software engineering and product excellence.
I don't think it's an anti-pattern. I think it's impossible. There is no local dev environment for serverless architectures. You cannot imitate [most] AWS resources, with the exception of compute environments. Thus, you can test AWS Lambdas locally (specifically via sam local invoke), fully simulating the execution environment (SAM does this itself via a container), but all other resources require a real deploy, as would end-to-end testing.
But imitation is likely to be invalid. At least once a week I have a user with an issue that ends up being tracked down to either some library that is available on their local environment that isn't on Lambda, one of the vagaries about how Lambda handles the call stack, an issue with connections to database and many more all because they were attempting to imitate compute locally.
Just test execution of the Lambda in the cloud and save yourself the hassle.
A cross-functional and emotionally intelligent executive leader and Army veteran with over 20 years of proven expertise in driving software engineering and product excellence.
No, sam local invoke will test your function in a Docker container running the correct versions of the OS and your language runtime, and while the hardware constraints my not be able to match exactly, it's close enough to be good enough 99% of the time. It's insane to suggest that because the testing environment is not 100% that of production, it is not useful, particularly since I'm talking about one provided by AWS itself. As someone who is constantly building on AWS Serverless technologies, sam local invoke saves a non-insignificant amount of time compared to waiting for sam deploy to finish. I say unit test correctly, and use sam local invoke to test side effects of your functions on other AWS resources in your stack.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I don't think it's an anti-pattern. I think it's impossible. There is no local dev environment for serverless architectures. You cannot imitate [most] AWS resources, with the exception of compute environments. Thus, you can test AWS Lambdas locally (specifically via
sam local invoke
), fully simulating the execution environment (SAM does this itself via a container), but all other resources require a real deploy, as would end-to-end testing.But imitation is likely to be invalid. At least once a week I have a user with an issue that ends up being tracked down to either some library that is available on their local environment that isn't on Lambda, one of the vagaries about how Lambda handles the call stack, an issue with connections to database and many more all because they were attempting to imitate compute locally.
Just test execution of the Lambda in the cloud and save yourself the hassle.
No,
sam local invoke
will test your function in a Docker container running the correct versions of the OS and your language runtime, and while the hardware constraints my not be able to match exactly, it's close enough to be good enough 99% of the time. It's insane to suggest that because the testing environment is not 100% that of production, it is not useful, particularly since I'm talking about one provided by AWS itself. As someone who is constantly building on AWS Serverless technologies,sam local invoke
saves a non-insignificant amount of time compared to waiting forsam deploy
to finish. I say unit test correctly, and usesam local invoke
to test side effects of your functions on other AWS resources in your stack.