Skip to content

Package generating incorrect package artifact path in serverless-state.json  #4188

Closed

Description

@dpandya

This is a (Bug Report )

Description

When I run serverless package --stage dit --package build the serverless-state.json still generates absolute path pointing to artifact inside of .serverless dir instead of the build. When I try to deploy the generated package using serverless deploy --stage dit --package build -vv I get an error complaining that the No function1.zip file found in the package path you provided.
If I manually go and edit the serverless-state.json inside the build dir with correct path pointing to the build dir instead of the .serverless dir then the deployment works fine.

For bug reports:

  • What went wrong?
    The serverless deploy --stage dit --package build -vv did not work.

  • What did you expect should have happened?
    It should have deployed artifacts from the specified package dir.

  • What stacktrace or error message from your provider did you see?

  Serverless Error ---------------------------------------

  No function1.zip file found in the package path you provided.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           7.4.0
     Serverless Version:     1.20.2

Additional Data

  • I have multiple functions

  • I am using package.individually as true

  • My use case is for build machine to perform the package step and upload generated artifacts to some shared location (such as S3) and then another deployment machine to download from S3 and perform the deploy. The directory paths on the build machine performing the package and the deployment machine performing the deploy are different.

  • Serverless Framework Version you're using:

serverless -version
1.20.2
  • Operating System:
OS X El Capitan
Version: 10.11.6
  • Stack Trace:
  Serverless Error ---------------------------------------

  No function1.zip file found in the package path you provided.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           7.4.0
     Serverless Version:     1.20.2

Activity

  1. ahmed-abdulmoniem commented on Jan 6, 2019

    @ahmed-abdulmoniem

    Happening with me as well.

  2. Idanatcox commented on Jan 10, 2019

    @Idanatcox

    I had the same issue, see #3525 (comment) for a workaround

  3. added 4 commits that reference this issue on Mar 14, 2019
    fe86fde
    e1f09f3
    c1e0a1b
    cd0d33d
  4. pmuens commented on Mar 19, 2019

    @pmuens
    Contributor

    Re-opening since we had to revert #5297...

  5. reopened this on Mar 19, 2019
  6. franciscomemoli commented on Mar 6, 2020

    @franciscomemoli

    Hello,
    Why this merge was revert? This change had some other implication?
    There is a new issue generated for this revert #6964.
    If there is another bug generated by this change please tell me and I will try to fix it.

  7. franciscomemoli commented on Mar 6, 2020

    @franciscomemoli

    On the lib/plugins/package/lib/zipService.js I found where the artifactFilePath is generated with an temp path, a fullpath to the .serverless folder.
    I don't know why that folder is still used when the user set the package folder, may be there is a reason but if I change this to use the package folder the problem is solved.
    I saw the comment but I cant find where all is moved to the package path and change the serverless-state.json functions artifact paths.

    old code:

    
        // Create artifact in temp path and move it to the package path (if any) later
        const artifactFilePath = path.join(
          this.serverless.config.servicePath,
          '.serverless',
          zipFileName
        );
    

    Changed code:

        // Create artifact in temp path and move it to the package path (if any) later
        let artifactInitalPath = path.join(
          this.serverless.config.servicePath,
          '.serverless'
        );
        if(this.packagePath){
          artifactInitalPath = this.packagePath;
        }
        const artifactFilePath = path.join(
          artifactInitalPath,
          zipFileName
        );
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions