3

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

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Mateen Kiani
  • 2,869
  • 2
  • 19
  • 29

1 Answers1

15

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

Mateen Kiani
  • 2,869
  • 2
  • 19
  • 29
  • 1
    according to the doc https://github.com/dherault/serverless-offline `reloadHandler` "Reloads handler with each request". It does not watch for change, this is very slow. – jrobichaud Dec 16 '22 at 20:02