serverless offline start hot reload not working
Asked Answered
L

1

7

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

Lepidopterous answered 10/11, 2022 at 13:7 Comment(0)
L
23

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

Lepidopterous answered 10/11, 2022 at 13:9 Comment(1)
according to the doc github.com/dherault/serverless-offline reloadHandler "Reloads handler with each request". It does not watch for change, this is very slow.Wrapped

© 2022 - 2024 — McMap. All rights reserved.