Skip to content

Task lambda_package create empty zip #4

Closed

Description

@jeromeheissler

I try to run the task on my iMac the generated zip doesn't contain any sources.

I added this piece of code to see files that are added to the archive. And I see nothing.

zipArchive.on('entry', function(data)   {
  console.log(data);
 });

Next I change the install_location to a directory on the project root, all the files to be compressed are listed correctly. But the archive is corrupt.

var install_location = "./.tmp";

Finally I changed the script that copies the archive to wait for the copy before deleting, and everything works.

output.on('close', function () {
  mkdirp('./' + options.dist_folder, function (err) {
    fs.createReadStream(install_location + '/' + archive_name + '.zip').pipe(
      fs.createWriteStream('./' + options.dist_folder + '/' + archive_name + '.zip')
    ).on('close', function(){
      rimraf(install_location, function () {
        grunt.config.set('lambda_deploy.' + task.target + '.package',
            './' + options.dist_folder + '/' + archive_name + '.zip');
        grunt.log.writeln('Created package at ' + options.dist_folder + '/' + archive_name + '.zip');
        done(true);
      });
    });
  });
});

I'm a beginner with node js and grunt, there is there a problem in my configuration or worries with the task ?

Activity

  1. Tim-B commented on Jan 29, 2015

    @Tim-B
    Owner

    Hi @jeromeheissler

    Is it at all possible to post a link to your code so I can try and run it myself? Even if just an example that prints "Hello World" or something but still exhibits the issue?

    Also, it might be useful to try a basic example using the archiver package to see if the NPM package itself is the issue or just this implementation using it.

    https://www.npmjs.com/package/archiver

    Cheers, Tim.

  2. jeromeheissler commented on Jan 29, 2015

    @jeromeheissler
    Author

    I create a project on github with a Hello World. When I run the command grunt lambda_package I have the same problem.

    https://github.com/jeromeheissler/test-lamdba

    I will try to use the archiver package alone

  3. jeromeheissler commented on Jan 29, 2015

    @jeromeheissler
    Author

    I also tried to clone your project and run the tests. I have this error:

    > grunt test
    Running "clean:tests" (clean) task
    
    Running "lambda_package:default_options" (lambda_package) task
    Created package at tmp/dist/my-lambda-function_0-0-1_2015-0-29-11-55-59.zip
    
    Running "lambda_package:custom_options" (lambda_package) task
    Created package at tmp/dist/another-lambda-function_0-0-1_latest.zip
    
    Running "nodeunit:tests" (nodeunit) task
    Testing lambda_invoke_test.js..OK
    Testing lambda_package_test.jsFatal error: Invalid or unsupported zip format. No END header found
  4. teu commented on Apr 9, 2015

    @teu

    Hi, same problem, empty deploy package...

  5. Tim-B commented on Apr 9, 2015

    @Tim-B
    Owner

    Hi @teu would it be possible to try a hello world example using the archiver package? https://www.npmjs.com/package/archiver

    That will help narrow down if the issue is with the library which generates the zip or how it's been implemented here.

  6. teu commented on Apr 10, 2015

    @teu

    Hi,

    had same problem with local file and buffer on ubuntu (also on AWS Lambda) so switched to another library. time permitting will try to submit something.

  7. Tim-B commented on May 23, 2015

    @Tim-B
    Owner

    I bumped the adm-zip version to the latest one which I hope will resolve this issue. I also tested it in a Windows 7 VM and it all worked fine.

  8. Tim-B commented on Jun 28, 2015

    @Tim-B
    Owner

    I've just released a new version including the pull request from @qen so hopefully this will be fixed. Let me know how you go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions