Skip to content

Cannot get aws-sdk working with Angular universal #1944

New issue

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

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

Already on GitHub? # to your account

Closed
achelkia opened this issue Feb 21, 2018 · 15 comments
Closed

Cannot get aws-sdk working with Angular universal #1944

achelkia opened this issue Feb 21, 2018 · 15 comments
Labels
guidance Question that needs advice or information.

Comments

@achelkia
Copy link

Hi,

We use aws-sdk with an Angular 5 application. Until now everything worked great.

We are trying to add server side rendering using angular-universal. When trying to build the server application, like this : https://github.com/angular/angular-cli/wiki/stories-universal-rendering#building-the-bundle , we get these errors :

ERROR in node_modules/aws-sdk/lib/http_response.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/http_response.d.ts(14,18): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(108,37): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(110,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(401,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/apigateway.d.ts(1121,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/clouddirectory.d.ts(1469,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(42,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cloudtrail.d.ts(141,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/codecommit.d.ts(1539,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts(2561,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/directconnect.d.ts(992,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dms.d.ts(432,35): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(2,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(93,30): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(274,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dynamodb.d.ts(466,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dynamodbstreams.d.ts(92,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ec2.d.ts(3006,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ecr.d.ts(767,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/firehose.d.ts(156,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/services/glacier.d.ts(10,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/glacier.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/glacier.d.ts(1313,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iam.d.ts(1112,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iam.d.ts(3106,35): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iotdata.d.ts(73,30): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iotdata.d.ts(74,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesis.d.ts(229,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kms.d.ts(328,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kms.d.ts(962,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lambda.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lambda.d.ts(364,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lambda.d.ts(365,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lexruntime.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lexruntime.d.ts(35,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/polly.d.ts(8,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/polly.d.ts(70,29): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/rekognition.d.ts(1135,27): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ses.d.ts(1513,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sns.d.ts(275,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sqs.d.ts(216,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ssm.d.ts(4564,48): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/support.d.ts(336,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/waf.d.ts(604,39): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/wafregional.d.ts(648,39): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/mobile.d.ts(106,26): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/mediastoredata.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/mediastoredata.d.ts(199,29): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/appsync.d.ts(240,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(121,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(53,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sagemakerruntime.d.ts(24,26): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/config.d.ts(1,34): error TS2307: Cannot find module 'http'.
node_modules/aws-sdk/lib/config.d.ts(2,35): error TS2307: Cannot find module 'https'.
node_modules/aws-sdk/lib/request.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/request.d.ts(132,45): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(10,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/s3.d.ts(777,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(1131,42): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(3473,32): error TS2304: Cannot find name 'Buffer'.

Please note that the client application still builds ok.

Thanks for your help.

@AllanZhengYP
Copy link
Contributor

Hi @achelkia
Can you show me your dependencies in package.json and tsconfig settings? It seems like the @types packages are not imported somewhere.

@achelkia
Copy link
Author

Thanks for the answer.
Here is the package.json :

"dependencies": {
    "@angular/animations": "^5.2.1",
    "@angular/cdk": "^5.1.0",
    "@angular/common": "^5.2.1",
...
    "aws-sdk": "^2.140.0",
  },
  "devDependencies": {
    "@angular/cli": "^1.6.5",
    "@angular/compiler-cli": "^5.2.1",
    "@angular/language-service": "^5.2.1",
    "@types/aws-sdk": "^2.7.0",
    "express-http-proxy": "^1.0.7",
    "typescript": "2.4.2"
  }

the tsconfig.app.json:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": ["node"]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

and the tsconfig.server.json:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "commonjs",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ],
  "angularCompilerOptions": {
    "entryModule": "app/app.server.module#AppServerModule"
  }
}

I already tried moving @types/aws-sdk from the dev-dependenciesto the dependencies but it didn't change anything.

@AllanZhengYP
Copy link
Contributor

I see you did not install @types/node. Our type definition uses Buffer, stream types which are declared in @type/node. Just try npm -i -d @types/node

@achelkia
Copy link
Author

achelkia commented Feb 23, 2018

Oh sorry about that :

"dependencies": {
    "@angular/animations": "^5.2.1",
    "@angular/cdk": "^5.1.0",
    "@angular/common": "^5.2.1",
    "@angular/compiler": "^5.2.1",
    "@angular/core": "^5.2.1",
    "@angular/forms": "^5.2.1",
    "@angular/http": "^5.2.1",
    "@angular/material": "^5.1.0",
    "@angular/platform-browser": "^5.2.1",
    "@angular/platform-browser-dynamic": "^5.2.1",
    "@angular/platform-server": "^5.2.1",
    "@angular/router": "^5.2.1",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "@types/fabric": "^1.5.27",
    "@types/node": "^8.0.50",
    "angular2-toaster": "^4.0.1",
    "aws-sdk": "^2.140.0",
    "bugsnag-js": "^4.0.3",
    "core-js": "^2.5.3",
    "fabric": "2.0.0-rc.4",
    "file-loader": "^1.1.6",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "ngx-carousel": "^1.3.5",
    "ngx-facebook": "^2.4.0",
    "ngx-infinite-scroll": "^0.6.1",
    "ngx-webstorage": "^2.0.1",
    "rxjs": "^5.5.6",
    "ts-loader": "^3.5.0",
    "web-animations-js": "^2.3.1",
    "webpack": "^3.10.0",
    "zone.js": "^0.8.20"
  }

We do have @types/node in our dependencies. I didn't put the whole thing for readability.
As I was saying, when we build using ng build --prod everything runs fine.

@AllanZhengYP
Copy link
Contributor

Hi @achelkia
Maybe you can try remove the "types": [] from the tsconfig.server.json? Our readme does mention you need to either add node to type list or remove the entry. Another issue #1271 provides a workaround for similar issue.

@achelkia
Copy link
Author

achelkia commented Mar 8, 2018

Hi @AllanFly120, thanks for the answer.
That was it, removing "types": [] or adding node did it for me.
Thanks again.

@jeskew jeskew closed this as completed Mar 8, 2018
@leonard333
Copy link

leonard333 commented Jun 28, 2018

I have the same problem but with angular 6, and even with these changes that comment can not solve the problem, I hope you can help me thanks!
screenshot_2

@carlara75
Copy link

carlara75 commented Jul 2, 2018

Hi, just upgraded to angular 6 yesterday and I having the same issue when trying to upload an object to S3. Browsing for answer I got to a post, which somehow I managed to lose, that gave me some ideas. The issue seems to be the SDK is not recognising it is running in a browser.

I just edited, for testing purpose only, node_module/aws-sdk/lib/utils.js (line 40) to

isNode: function isNode() { return false },

instead

isNode: function isNode() { return !util.isBrowser(); },

and I have my application running again.

I assume something changed in the guts of angular or nodes, in my case running v6.0.3 and v8.11.3 respectively, which makes aws-sdk to behave differently.

@chandra-kantha
Copy link

Adding "types":["node"] to tsconfig.app.json file worked for me.

@Samarth-Srivastava
Copy link

Angular 6,
First I got the error while compiling :

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

So as suggested in this post:
I added "types": ["node"] to tsconfig.app.json

Project Compiled successfully.

But then it did open on browser.
Got the error in console:

Uncaught ReferenceError: global is not defined

So as suggested in other issue on https://github.com/aws-amplify/amplify-js/issues/678
added following line

// Add global to window, assigning the value of window itself.
(window as any).global = window;

got my app working

@Omi0
Copy link

Omi0 commented Oct 4, 2018

In my case. I used global types and "types":["node"] inside tsconfig.app.json was overwriting "typeRoots" value inside tsconfig json. So the solution is as follows:

  1. 1 remove "types" from tsconfig.app.json
  2. Ensure that global types are declared inside tsconfig json as follows
    "typeRoots": ["node_modules/@types"]
  3. IMPORTANT. Add browser: true settings. In my case it was inside polyfils.ts as
    (window as any).process = {
    browser: true //IMPORTANT for aws-sdk
    };

@ndamulelonemakh
Copy link

Adding "types":["node"] to tsconfig.app.json file worked for me.

This worked for me on IONIC 4.5.0 & Angular 7.1.3. Alternatively you can remove types from the same location.

@srchase srchase added guidance Question that needs advice or information. and removed Question labels Jan 4, 2019
@VivithaAlamur
Copy link

VivithaAlamur commented Feb 2, 2019

We are also facing the same issue while building the library in angular7.
our package.json file inside library::
{
"name": "common-registration",
"version": "0.0.1-5",
"peerDependencies": {
"@angular/common": "^7.2.0",
"@angular/core": "^7.2.0",
"@lodash.merge": "^4.6.1",
"@angular/http": "^7.2.0",
"@angular/router": "^7.2.0",
"rxjs": "^6.3.3",
"@angular/forms": "^7.2.0",
"@angular/material": "^7.1.1",
"ngx-toastr": "^9.1.1",
"@angular/cdk": "^7.1.1",
"ngx-auto-unsubscribe": "^2.4.1",
"aws-sdk": "^2.270.1",
"ngx-webstorage": "^3.0.0-beta.14",
"@ng-select/ng-select": "^2.14.0",
"@ngx-translate/core": "^10.0.2",
"@ngx-translate/http-loader": "^3.0.1",
"@types/node": "^8.10.26"
}
}
package.json for app

{
"name": "registration",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prebuild:library:dev": "cross-env LIB_ENV=dev node projects/common-registration/src/lib/environment-switcher.js",
"build:library:dev": "ng build common-registration --prod",
"prebuild:library:qa": "cross-env LIB_ENV=qa node projects/common-registration/src/lib/environment-switcher.js",
"build:library:qa": "ng build common-registration --prod",
"prebuild:library:prod": "cross-env LIB_ENV=prod node projects/common-registration/src/lib/environment-switcher.js",
"build:library:prod": "ng build common-registration --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/cdk": "^7.1.1",
"@angular/common": "^7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "^7.2.0",
"@angular/forms": "^7.2.0",
"@angular/http": "^7.2.0",
"@angular/material": "^7.1.1",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "^7.2.0",
"@ng-select/ng-select": "^2.14.0",
"@ngx-translate/core": "^10.0.2",
"@ngx-translate/http-loader": "^3.0.1",
"aws-sdk": "^2.270.1",
"core-js": "^2.5.4",
"lodash.merge": "^4.6.1",
"ngx-auto-unsubscribe": "^2.4.1",
"ngx-toastr": "^9.1.1",
"ngx-webstorage": "^3.0.0-beta.14",
"rxjs": "^6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.12.0",
"@angular-devkit/build-ng-packagr": "~0.12.0",
"@angular/cli": "~7.2.3",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.10.39",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^4.2.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tsickle": ">=0.34.0",
"tslib": "^1.9.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}

tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": ["node"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}

tsconfig.json

{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"types": [ "node" ],
"lib": [
"es2018",
"dom"
],
"paths": {
"common-registration": [
"dist/common-registration"
],
"common-registration/": [
"dist/common-registration/
"
]
}
}
}

Facing build error

BUILD ERROR
node_modules/aws-sdk/lib/http_response.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/http_response.d.ts(14,18): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(132,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(134,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(468,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(470,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/apigateway.d.ts(1146,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/clouddirectory.d.ts(1573,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(42,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cloudtrail.d.ts(141,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/codecommit.d.ts(634,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/codecommit.d.ts(1601,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts(2581,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/directconnect.d.ts(992,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/dms.d.ts(448,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(2,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(93,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(274,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field
in your tsconfig.
node_modules/aws-sdk/clients/dynamodb.d.ts(498,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/dynamodbstreams.d.ts(92,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/ec2.d.ts(3074,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/ecr.d.ts(767,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/firehose.d.ts(182,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/lib/services/glacier.d.ts(10,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/glacier.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/glacier.d.ts(1313,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iam.d.ts(1120,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iam.d.ts(3118,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iot.d.ts(4487,27): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iotdata.d.ts(73,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iotdata.d.ts(74,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/kinesis.d.ts(237,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/kms.d.ts(328,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/kms.d.ts(962,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/lambda.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lambda.d.ts(372,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/lambda.d.ts(373,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/lexruntime.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lexruntime.d.ts(35,28): error TS2580: Cannot find name 'Buffer'. Do you need to
install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/polly.d.ts(8,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/polly.d.ts(70,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/rekognition.d.ts(1135,27): error TS2580: Cannot find name 'Buffer'. Do you need
to install type definitions for node? Try npm i @types/node and then add node to the types field in your
tsconfig.
node_modules/aws-sdk/clients/ses.d.ts(1513,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/sns.d.ts(275,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/sqs.d.ts(216,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/ssm.d.ts(4954,48): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/support.d.ts(336,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/waf.d.ts(628,39): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/wafregional.d.ts(672,39): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/lexmodelbuildingservice.d.ts(306,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/mobile.d.ts(106,26): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/mediastoredata.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/mediastoredata.d.ts(199,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/appsync.d.ts(248,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(121,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(53,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/sagemakerruntime.d.ts(24,26): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acmpca.d.ts(283,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acmpca.d.ts(285,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acmpca.d.ts(353,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/secretsmanager.d.ts(627,34): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iotanalytics.d.ts(1007,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/lib/config.d.ts(1,34): error TS2307: Cannot find module 'http'.
node_modules/aws-sdk/lib/config.d.ts(2,35): error TS2307: Cannot find module 'https'.
node_modules/aws-sdk/lib/request.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/request.d.ts(132,45): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/lib/event-stream/event-stream.d.ts(1,55): error TS2503: Cannot find namespace 'NodeJS'.
node_modules/aws-sdk/clients/s3.d.ts(11,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/s3.d.ts(787,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/s3.d.ts(1151,42): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/s3.d.ts(3347,15): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/s3.d.ts(3553,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
Error: node_modules/aws-sdk/lib/http_response.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/http_response.d.ts(14,18): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(132,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(134,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(468,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/acm.d.ts(470,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/apigateway.d.ts(1146,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/clouddirectory.d.ts(1573,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(42,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cloudtrail.d.ts(141,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/codecommit.d.ts(634,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/codecommit.d.ts(1601,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts(2581,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/directconnect.d.ts(992,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/dms.d.ts(448,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(2,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(93,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(274,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field
in your tsconfig.
node_modules/aws-sdk/clients/dynamodb.d.ts(498,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/dynamodbstreams.d.ts(92,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/ec2.d.ts(3074,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/ecr.d.ts(767,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.node_modules/aws-sdk/clients/firehose.d.ts(182,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/lib/services/glacier.d.ts(10,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/glacier.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/glacier.d.ts(1313,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iam.d.ts(1120,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iam.d.ts(3118,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iot.d.ts(4487,27): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iotdata.d.ts(73,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/iotdata.d.ts(74,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig.

@devaananth
Copy link

devaananth commented Apr 30, 2019

I see you did not install @types/node. Our type definition uses Buffer, stream types which are declared in @type/node. Just try npm -i -d @types/node

It worked for me,. I missed to install @types/node and added "node" to the types field in tsconfig

@lock
Copy link

lock bot commented Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests