Skip to content

Fix for only one function deploy #292

@Marcosl14

Description

@Marcosl14

When I try to deploy only one function using layers, I got the next error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

And it is produced, because the function moveArtifacts() in the index.ts is looking for the service.layers[name].package.artifact which should be generated during the entire stack deploy.

So when deploying only one function with sls deploy --stage stage --region us-east-1 --verbose -f functionName, the code is trying to find the layer artifact which is generated when deploying the full stack (so... it doesn't exists at this point).

If I add the property artifact to the layer pointing to .serverless/libraries.zip I was able to deploy the function, but when I tried to deploy the stack, I recieved the next error: OperationalError: ENOENT: no such file or directory, because it was already not generated.

So, the fix is in the index file in the moveArtifacts() function.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions