Skip to content

Hooks executed twice with serverless-offline #38

@bboure

Description

@bboure

Hi there!

It seems like this plugin when used with serverless-offline executes some Serverless lifecycle hooks twice. Specifically, this line. I am not familiar with that method, but I think it is the programmatic equivalent of doing sls export-env, which will (re)execute all hooks.

I came across this issue because I also use lift. When executing sls offline start, I get an error that is thrown here, which probably indicates that the initialize hook is executed twice.

If I comment this line, the problem goes away.

I think that initOfflineHook() should probably call the internal functions (["collect", "resolve", "apply", "write") programmatically instead. It will not only fix this issue but also avoid useless double code execution.

As a side note, I tried to solve this issue for me by setting enableOffline to false. It didn't work because the command (export-env) is executed anyway and the check is done later.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions