aws-lambdaserverlessserverless-offline

serverless offline start hot reload not working


I am unable to hot reload when using serverless offline start.

Here is my serverless.yml file

service: function-with-environment-variables

frameworkVersion: ">=3.0.0 <4.0.0"

provider:
  name: aws
  runtime: nodejs16.x
 
plugins:
  - serverless-offline

functions:
  register:
    handler: handler.register
    events:
      - http:
          path: /register
          method: post

  login:
    handler: handler.login
    events:
      - http:
          path: /login
          method: post

  verify:
    handler: handler.verify
    events:
      - http:
          path: /verify
          method: post

I have also tried using sls offline start still facing same error.

Here is the output of serverless --version

`Running "serverless" from node_modules Framework Core: 3.24.1 (local) 3.24.1 (global) Plugin: 6.2.2 SDK: 4.3.2


Solution

  • Try using this command to start your server:

    serverless offline start --reloadHandler
    

    reloadHandler Reloads handler with each request. More info here: https://github.com/dherault/serverless-offline/issues/864#issuecomment-1190950178