Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task lambda_package create empty zip #4

Closed
jeromeheissler opened this issue Jan 28, 2015 · 8 comments
Closed

Task lambda_package create empty zip #4

jeromeheissler opened this issue Jan 28, 2015 · 8 comments

Comments

@jeromeheissler
Copy link

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 ?

@Tim-B
Copy link
Owner

Tim-B commented Jan 29, 2015

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.

@jeromeheissler
Copy link
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

@jeromeheissler
Copy link
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

@teu
Copy link

teu commented Apr 9, 2015

Hi, same problem, empty deploy package...

@Tim-B
Copy link
Owner

Tim-B commented Apr 9, 2015

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.

@teu
Copy link

teu commented Apr 10, 2015

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.

@Tim-B
Copy link
Owner

Tim-B commented May 23, 2015

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.

@Tim-B
Copy link
Owner

Tim-B commented Jun 28, 2015

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.

@Tim-B Tim-B closed this as completed Jul 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants