Home > front end >  How to run/debug serverless(framework) application locally?
How to run/debug serverless(framework) application locally?

Time:01-15

I have this application created with serverless framework using python language, but I am not finding a way to debug it locally or at least run it just to test it out before deploying it to amazon's web services.

Is there any way to run serverless application (with python) using pycharm or any other tool?

CodePudding user response:

The problem is that you are confuse about what is the Serverless framework, this framework is just for work with infrastructure as a code, this is why you don't see anywhere how to debug your code with it, it's because this don't make sense.

With Serveless framework, you just write your infrastructure (s3, lambdas, ec2) to support your code and they will create everything on aws/google cloud etc;

So this is complete different concept, you can't "run or debug" your code with serverless, because serverless don't are a framework to write or run applications.

For sample, imagine this scenario:

I have a python function, that I wrote, let's call it greet. To execute it and debug it, I need to execute it normally calling python greet.py or just running or debug via IDE (like Pycharm).

Once time this is done and functional, I want to run it on the cloud, now I write a serverless.yml to create everything that I need on the cloud and push my code to there.

CodePudding user response:

it is possible to some extent. The first way is using invoke local command to invoke individual functions. The other way is to use serverless-offline plugin: https://github.com/dherault/serverless-offline

  •  Tags:  
  • Related