lambda-packager icon indicating copy to clipboard operation
lambda-packager copied to clipboard

`lambda-packager deploy` fails with ENOENT

Open dcrockwell opened this issue 10 years ago • 7 comments

$ lambda-packager deploy
? Stack name lambda-packager
? Region us-east-1
Creating stack lambda-packager...
This may take a few minutes.
ENOENT: no such file or directory, open '/Users/dcrockwell/.nvm/versions/node/v4.2.1/lib/node_modules/lambda-packager/blueprints/cloudformation-template.json'

This is on Node v4 if it matters.

dcrockwell avatar Nov 19 '15 02:11 dcrockwell

Using 0.2.1 from npm and adding there old template from here: https://github.com/tomdale/lambda-packager/blob/0564aacd837bb7ddfe7e310929c7961ba28c6e7a/blueprints/cloudformation.json

resolves the ENOENT but it still fails:

% DEBUG=lambda-packager:cloud-formation lambda-packager deploy
? Stack name lambda-packager
? Region us-east-1
Creating stack lambda-packager...
This may take a few minutes.
  lambda-packager:cloud-formation creating stack; name= +0ms lambda-packager ; template= {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Provisions a Lambda function for compiling npm packages via the lambda-packager package.",
    "Resources": {
        "OutputBucket": {
            "Type": "AWS::S3::Bucket"
        },
        "ExecutionRole": {
            "Type": "AWS::IAM::Role",
            "Properties": {
                "AssumeRolePolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [{
                        "Effect": "Allow",
                        "Principal": {
                            "Service": ["lambda.amazonaws.com"]
                        },
                        "Action": ["sts:AssumeRole"]
                    }]
                },
                "Policies": [{
                    "PolicyName": "LambdaPackager",
                    "PolicyDocument": {
                        "Version": "2012-10-17",
                        "Statement": [{
                            "Effect": "Allow",
                            "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
                            "Resource": "arn:aws:logs:*:*:*"
                        }, {
                            "Effect": "Allow",
                            "Action": ["s3:GetObject", "s3:PutObject"],
                            "Resource": ["arn:aws:s3:::*"]
                        }]
                    }
                }]
            }
        },
        "LambdaFunction": {
            "Type": "AWS::Lambda::Function",
            "Properties": {
                "Handler": "handler.handler",
                "Role": {
                    "Fn::GetAtt": ["ExecutionRole", "Arn"]
                },
                "Runtime": "nodejs",
                "Timeout": "300",
                "Code": {
                    "S3Bucket": "lambda-packager",
                    "S3Key": "output.zip"
                }
            }
        }
    },
    "Outputs": {
        "Bucket": {
            "Value": {
                "Ref": "OutputBucket"
            }
        },
        "Function": {
            "Value": {
                "Ref": "LambdaFunction"
            }
        }
    }
}

  lambda-packager:cloud-formation cloudformation error; err= +567ms { [OptInRequired: The AWS Access Key Id needs a subscription for the service]
  message: 'The AWS Access Key Id needs a subscription for the service',
  code: 'OptInRequired',
  time: Thu Dec 24 2015 09:43:49 GMT-0800 (PST),
  requestId: 'e372fa01-aa65-11e5-ac9f-f513d706eb04',
  statusCode: 403,
  retryable: false,
  retryDelay: 30 }

michaelwills avatar Dec 24 '15 17:12 michaelwills

Also failing for me with ENOENT on lambda-packager/blueprints/cloudformation-template.json

davidsulpy avatar Jan 29 '16 23:01 davidsulpy

When I manually add the cloudformation template, the cloudformation stack fails to create because of a lack of permissions to get the resource at s3 bucket lambda-packager and key output.zip

davidsulpy avatar Jan 29 '16 23:01 davidsulpy

Same problems here.

gmaclennan avatar Feb 25 '16 01:02 gmaclennan

Same problem. lambda-packager/blueprints/cloudformation-template.json doesn't exist for some reason. @hmcfletch created a fork that fixes this issue. Of course, you still need the permissions to deploy cloudformation.

fix/add-cloudformation-blueprint

jgreen01 avatar Aug 30 '16 18:08 jgreen01

the fork mentioned by @jgreen82 produces just the same error.

ariesshrimp avatar Oct 02 '16 05:10 ariesshrimp

@joefraley the fork by @jgreen82 solves the original issue, but the fix branch isn't merged into master. so you need to pull that branch and work from there. it's at the bottom of that README.

magentanova avatar Oct 27 '17 19:10 magentanova