Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

Hang on deploy #112

Open humanatwork opened 5 years ago

humanatwork commented 5 years ago

Before anything, just want to say this library rocks. I've been using it regularly, and it's saved me a ridiculous amount of time!

That said, I've just run into a strange issue that seems to only occur with this particular Lambda function upon attempting to deploy — I've tested deployment on other recently created Lambdas and they all work just fine. When I run grunt deploy, grunt seems to simply hang indefinitely until the process is killed right after it begins packaging the zip (I'm new to Grunt so this might not actually be where the process is getting stuck, fyi). Here's a console readout for ref:

Running "lambda_package:default" (lambda_package) task
npm WARN peerDependencies The peer dependency aws-sdk@2.x included from dynamodb-wrapper will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated text-encoding@0.6.4: no longer maintained
lambda_parseTimezoneData@1.0.0 ../../../../../../../../var/folders/gs/688nwl_57919sfz06c_rhhvm0000gn/T/1539121699197.6658/node_modules/lambda_parseTimezoneData
├── luxon@1.4.3
├── util@0.11.0 (inherits@2.0.3)
├── aws-sdk@2.331.0 (sax@1.2.1, ieee754@1.1.8, querystring@0.2.0, uuid@3.1.0, events@1.1.1, jmespath@0.15.0, url@0.10.3, xml2js@0.4.19, buffer@4.9.1)
├── dynamodb-wrapper@1.4.1
└── geo-tz@4.0.2 (timed-cache@1.1.0, @turf/helpers@6.1.4, @turf/boolean-point-in-polygon@6.0.1, pbf@3.1.0, geobuf@3.0.1)

And here's my Gruntfile:

const grunt = require('grunt');

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-aws-lambda');
    grunt.loadNpmTasks('grunt-exec');

    grunt.initConfig({
        exec: {
            default: {
                cmd: 'source ./auth.sh'
            }
        },
        lambda_invoke: {
            default: {
                arn: 'arn:aws:lambda:us-east-1:***********:function:lambda_parseTimezoneData',
                options: {
                    file_name: 'index.js',
                    event: 'event.json',
                    profile: 'flyright',
                    region: 'us-east-1'
                }
            }
        },
        lambda_deploy: {
            default: {
                arn: 'arn:aws:lambda:us-east-1:************:function:lambda_parseTimezoneData'
            }
        },
        lambda_package: {
            default: {
            }
        }
    });

    // Register local Lambda test task
    grunt.registerTask('default', ['exec', 'lambda_invoke']);

    // Register deploy task
    grunt.registerTask('deploy', ['lambda_package', 'lambda_deploy']);
}

Things to note: This file is identical to half-a-dozen others that all work and deploy just fine (several include the NPM dynamodb-wrapper warnings seen above); the only difference is the npm WARN deprecated text-encoding message — could that deep-level dependency be stopping Lambda from accepting the upload? Just an idea... — and the default local invocation action works as expected. One other possible point of interest here might be that I accidentally attempted to run the deploy action once before actually creating the lambda function in AWS. Of course, I went ahead and created it, but I'm wondering if that might have something to do with this. Any ideas?

humanatwork commented 5 years ago

Didn't see this issue before, but possibly relevant: https://github.com/Tim-B/grunt-aws-lambda/issues/38