Skip to content

"error TS2304: Cannot find name 'Buffer'" and other webpack TS-errors in '/serverless-aws-lambda-typescript-webpack/' #21

@cibelius

Description

@cibelius

I cloned your '/serverless-aws-lambda-typescript-webpack/' files, rannpm install and when I run
serverless webpack --out dist I get a bunch of TS errors:

cihanbebek:my-repo cihanbebek$ serverless webpack --out dist
Serverless: Bundling with Webpack...
ts-loader: Using typescript@2.0.0 and /Users/cihanbebek/my-repo/tsconfig.json
Time: 4298ms
          Asset      Size  Chunks             Chunk Names
     handler.js   74.2 kB       0  [emitted]  main
aws-config.json  69 bytes          [emitted]

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/wafregional.d.ts
(416,39): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/waf.d.ts
(372,39): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/support.d.ts
(336,22): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/sqs.d.ts
(192,24): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/sns.d.ts
(275,24): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/ses.d.ts
(1127,32): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/s3/managed_upload.d.ts
(15,16): error TS2304: Cannot find name 'Promise'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/s3.d.ts
(744,22): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/s3.d.ts
(1048,42): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/s3.d.ts
(3211,32): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/rekognition.d.ts
(424,27): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/polly.d.ts
(69,29): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/lambda.d.ts
(307,23): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/lambda.d.ts
(308,28): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/kms.d.ts
(304,32): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/kms.d.ts
(901,31): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/kinesis.d.ts
(197,22): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/iotdata.d.ts
(73,30): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/iotdata.d.ts
(74,25): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/iam.d.ts
(1079,32): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/iam.d.ts
(2997,35): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/services/glacier.d.ts
(10,28): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/glacier.d.ts
(1116,24): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/firehose.d.ts
(144,22): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/ecr.d.ts
(612,31): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/ec2.d.ts
(2577,23): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/dynamodbstreams.d.ts
(92,38): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts
(2,25): error TS2307: Cannot find module 'stream'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts
(81,30): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts
(168,38): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/dynamodb.d.ts
(291,38): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/dms.d.ts
(358,35): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/directconnect.d.ts
(490,28): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/codecommit.d.ts
(639,22): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/cloudtrail.d.ts
(141,28): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/cloudsearchdomain.d.ts
(41,23): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/clouddirectory.d.ts
(841,38): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/apigateway.d.ts
(991,23): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/http_response.d.ts
(1,25): error TS2307: Cannot find module 'stream'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/http_response.d.ts
(14,18): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/request.d.ts
(1,25): error TS2307: Cannot find module 'stream'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/request.d.ts
(132,45): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/request.d.ts
(164,16): error TS2304: Cannot find name 'Promise'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/acm.d.ts
(108,37): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/acm.d.ts
(110,38): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/clients/acm.d.ts
(344,32): error TS2304: Cannot find name 'Buffer'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(27,84): error TS1110: Type expected.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(34,62): error TS1110: Type expected.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(66,133): error TS1110: Type expected.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(73,111): error TS1110: Type expected.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(1,34): error TS2307: Cannot find module 'http'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(2,35): error TS2307: Cannot find module 'https'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(27,66): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(34,43): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(38,37): error TS2304: Cannot find name 'Promise'.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(66,115): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

ERROR in /Users/cihanbebek/my-repo/node_modules/aws-sdk/lib/config.d.ts
(73,92): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

ERROR in ./src/handler.ts
(1,21): error TS2307: Cannot find module 'fs'.

ERROR in ./src/handler.ts
(8,1): error TS2304: Cannot find name 'exports'.

  Error --------------------------------------------------

     Webpack compilation error, see above

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions