Aws-sdk-js: Aws-Sdk + Typescript

Created on 14 Nov 2017  路  12Comments  路  Source: aws/aws-sdk-js

My Ionic 2 (typescript) based project was working fine till now, suddenly when I fired command 'ionic build' I was surprised to get multiple errors.
`
Running app-scripts build:
[23:38:50] build dev started ...
[23:38:50] clean started ...
[23:38:50] clean finished in 7 ms
[23:38:50] copy started ...
[23:38:50] deeplinks started ...
[23:38:50] deeplinks finished in 143 ms
[23:38:50] transpile started ...
[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/acm.d.ts, line: 108
Cannot find name 'Buffer'.

 L107:  export type CertificateBody = string;
 L108:  export type CertificateBodyBlob = Buffer|Uint8Array|Blob|string;
 L109:  export type CertificateChain = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/acm.d.ts, line: 110
Cannot find name 'Buffer'.

 L109:  export type CertificateChain = string;
 L110:  export type CertificateChainBlob = Buffer|Uint8Array|Blob|string;
 L111:  export interface CertificateDetail {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/acm.d.ts, line: 344
Cannot find name 'Buffer'.

 L343:  export type NextToken = string;
 L344:  export type PrivateKeyBlob = Buffer|Uint8Array|Blob|string;
 L345:  export interface RemoveTagsFromCertificateRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/apigateway.d.ts, line: 1071
Cannot find name 'Buffer'.

L1071:  export type _Blob = Buffer|Uint8Array|Blob|string;
L1072:  export type Boolean = boolean;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/clouddirectory.d.ts, line: 1445
Cannot find name 'Buffer'.

L1445:  export type BinaryAttributeValue = Buffer|Uint8Array|Blob|string;
L1446:  export type Bool = boolean;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/cloudsearchdomain.d.ts, line: 7
Cannot find module 'stream'.

   L6:  import {ConfigBase as Config} from '../lib/config';
   L7:  import {Readable} from 'stream';
   L8:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/cloudsearchdomain.d.ts, line: 42
Cannot find name 'Buffer'.

  L41:  export type Adds = number;
  L42:  export type _Blob = Buffer|Uint8Array|Blob|string|Readable;
  L43:  export interface Bucket {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/cloudtrail.d.ts, line: 141
Cannot find name 'Buffer'.

 L140:  export type Boolean = boolean;
 L141:  export type ByteBuffer = Buffer|Uint8Array|Blob|string;
 L142:  export interface CreateTrailRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/codecommit.d.ts, line: 667
Cannot find name 'Buffer'.

 L667:  export type blob = Buffer|Uint8Array|Blob|string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts, line: 2070
Cannot find name 'Buffer'.

L2069:  export type IdpIdentifiersListType = IdpIdentifierType[];
L2070:  export type ImageFileType = Buffer|Uint8Array|Blob|string;
L2071:  export type ImageUrlType = string;

[23:39:03] typescript: D:/Texple/Products/MPA/PoC/gps/node_modules/aws-sdk/clients/directconnect.d.ts, line: 992
Cannot find name 'Buffer'.

 L992:  export type LoaContent = Buffer|Uint8Array|Blob|string;
 L993:  export type LoaContentType = "application/pdf"|string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/dms.d.ts, line: 416
Cannot find name 'Buffer'.

 L415:  export type CertificateList = Certificate[];
 L416:  export type CertificateWallet = Buffer|Uint8Array|Blob|string;
 L417:  export type CompressionTypeValue = "none"|"gzip"|string;

[23:39:03] typescript: D:/Texple/Products/MPA/PoC/gps/node_modules/aws-sdk/clients/dynamodb.d.ts, line: 309
Cannot find name 'Buffer'.

 L308:  export type BatchWriteItemRequestMap = {[key: string]: WriteRequests};
 L309:  export type BinaryAttributeValue = Buffer|Uint8Array|Blob|string;
 L310:  export type BinarySetAttributeValue = BinaryAttributeValue[];

[23:39:03] typescript: D:/Texple/Products/MPA/PoC/gps/node_modules/aws-sdk/clients/dynamodbstreams.d.ts, line: 92
Cannot find name 'Buffer'.

  L92:  export type BinaryAttributeValue = Buffer|Uint8Array|Blob|string;
  L93:  export type BinarySetAttributeValue = BinaryAttributeValue[];

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/ec2.d.ts, line: 2791
Cannot find name 'Buffer'.

L2790:  export type BillingProductList = String[];
L2791:  export type _Blob = Buffer|Uint8Array|Blob|string;
L2792:  export interface BlobAttributeValue {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/ecr.d.ts, line: 767
Cannot find name 'Buffer'.

 L766:  export type LayerList = Layer[];
 L767:  export type LayerPartBlob = Buffer|Uint8Array|Blob|string;
 L768:  export type LayerSizeInBytes = number;

[23:39:03] typescript: D:/Texple/Products/MPA/PoC/gps/node_modules/aws-sdk/clients/firehose.d.ts, line: 161
Cannot find name 'Buffer'.

 L161:  export type Data = Buffer|Uint8Array|Blob|string;
 L162:  export type DataTableColumns = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/glacier.d.ts, line: 7
Cannot find module 'stream'.

   L6:  import {ConfigBase as Config} from '../lib/config';
   L7:  import {Readable} from 'stream';
   L8:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/glacier.d.ts, line: 1117
Cannot find name 'Buffer'.

L1116:  export type StatusCode = "InProgress"|"Succeeded"|"Failed"|string;
L1117:  export type Stream = Buffer|Uint8Array|Blob|string|Readable;
L1118:  export type TagKey = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/iam.d.ts, line: 1112
Cannot find name 'Buffer'.

L1112:  export type BootstrapDatum = Buffer|Uint8Array|Blob|string;
L1113:  export interface ChangePasswordRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/iam.d.ts, line: 3106
Cannot find name 'Buffer'.

L3106:  export type ReportContentType = Buffer|Uint8Array|Blob|string;
L3107:  export type ReportFormatType = "text/csv"|string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/iotdata.d.ts, line: 73
Cannot find name 'Buffer'.

  L73:  export type JsonDocument = Buffer|Uint8Array|Blob|string;
  L74:  export type Payload = Buffer|Uint8Array|Blob|string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/iotdata.d.ts, line: 74
Cannot find name 'Buffer'.

  L73:  export type JsonDocument = Buffer|Uint8Array|Blob|string;
  L74:  export type Payload = Buffer|Uint8Array|Blob|string;
  L75:  export interface PublishRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/kinesis.d.ts, line: 221
Cannot find name 'Buffer'.

 L221:  export type Data = Buffer|Uint8Array|Blob|string;
 L222:  export interface DecreaseStreamRetentionPeriodInput {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/kms.d.ts, line: 328
Cannot find name 'Buffer'.

 L328:  export type CiphertextType = Buffer|Uint8Array|Blob|string;
 L329:  export interface CreateAliasRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/kms.d.ts, line: 962
Cannot find name 'Buffer'.

 L961:  export type PendingWindowInDaysType = number;
 L962:  export type PlaintextType = Buffer|Uint8Array|Blob|string;
 L963:  export type PolicyNameList = PolicyNameType[];

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/lambda.d.ts, line: 7
Cannot find module 'stream'.

   L6:  import {ConfigBase as Config} from '../lib/config';
   L7:  import {Readable} from 'stream';
   L8:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/lambda.d.ts, line: 332
Cannot find name 'Buffer'.

 L331:  export type BatchSize = number;
 L332:  export type _Blob = Buffer|Uint8Array|Blob|string;
 L333:  export type BlobStream = Buffer|Uint8Array|Blob|string|Readable;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/lambda.d.ts, line: 333
Cannot find name 'Buffer'.

 L332:  export type _Blob = Buffer|Uint8Array|Blob|string;
 L333:  export type BlobStream = Buffer|Uint8Array|Blob|string|Readable;
 L334:  export type Boolean = boolean;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/lexruntime.d.ts, line: 7
Cannot find module 'stream'.

   L6:  import {ConfigBase as Config} from '../lib/config';
   L7:  import {Readable} from 'stream';
   L8:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/lexruntime.d.ts, line: 35
Cannot find name 'Buffer'.

  L34:  export type AttributesString = string;
  L35:  export type BlobStream = Buffer|Uint8Array|Blob|string|Readable;
  L36:  export type BotAlias = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/mobile.d.ts, line: 106
Cannot find name 'Buffer'.

 L105:  export type ConsoleUrl = string;
 L106:  export type Contents = Buffer|Uint8Array|Blob|string;
 L107:  export interface CreateProjectRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/polly.d.ts, line: 8
Cannot find module 'stream'.

   L7:  import {Presigner as presigner} from '../lib/polly/presigner';
   L8:  import {Readable} from 'stream';
   L9:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/polly.d.ts, line: 70
Cannot find name 'Buffer'.

  L69:  export type Alphabet = string;
  L70:  export type AudioStream = Buffer|Uint8Array|Blob|string|Readable;
  L71:  export type ContentType = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/rekognition.d.ts, line: 561
Cannot find name 'Buffer'.

 L561:  export type ImageBlob = Buffer|Uint8Array|Blob|string;
 L562:  export type ImageId = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/s3.d.ts, line: 10
Cannot find module 'stream'.

   L9:  import {PresignedPost as presigned_post} from '../lib/s3/presigned_post';
  L10:  import {Readable} from 'stream';
  L11:  interface Blob {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/s3.d.ts, line: 777
Cannot find name 'Buffer'.

 L776:  export type AnalyticsS3ExportFileFormat = "CSV"|string;
 L777:  export type Body = Buffer|Uint8Array|Blob|string|Readable;
 L778:  export interface Bucket {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/s3.d.ts, line: 1082
Cannot find name 'Buffer'.

L1081:  export type CopySourceSSECustomerAlgorithm = string;
L1082:  export type CopySourceSSECustomerKey = Buffer|Uint8Array|Blob|string;
L1083:  export type CopySourceSSECustomerKeyMD5 = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/s3.d.ts, line: 3320
Cannot find name 'Buffer'.

L3319:  export type SSECustomerAlgorithm = string;
L3320:  export type SSECustomerKey = Buffer|Uint8Array|Blob|string;
L3321:  export type SSECustomerKeyMD5 = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/ses.d.ts, line: 1316
Cannot find name 'Buffer'.

L1316:    Data: RawMessageData;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/sns.d.ts, line: 275
Cannot find name 'Buffer'.

 L275:  export type Binary = Buffer|Uint8Array|Blob|string;
 L276:  export interface CheckIfPhoneNumberIsOptedOutInput {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/sqs.d.ts, line: 216
Cannot find name 'Buffer'.

 L215:  export type BatchResultErrorEntryList = BatchResultErrorEntry[];
 L216:  export type Binary = Buffer|Uint8Array|Blob|string;
 L217:  export type BinaryList = Binary[];

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/ssm.d.ts, line: 4367
Cannot find name 'Buffer'.

L4367:  export type MaintenanceWindowLambdaPayload = Buffer|Uint8Array|Blob|string;
L4368:  export type MaintenanceWindowLambdaQualifier = string;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/support.d.ts, line: 336
Cannot find name 'Buffer'.

 L336:  export type Data = Buffer|Uint8Array|Blob|string;
 L337:  export interface DescribeAttachmentRequest {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/waf.d.ts, line: 544
Cannot find name 'Buffer'.

 L543:  export type ByteMatchSetUpdates = ByteMatchSetUpdate[];
 L544:  export type ByteMatchTargetString = Buffer|Uint8Array|Blob|string;
 L545:  export interface ByteMatchTuple {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/clients/wafregional.d.ts, line: 588
Cannot find name 'Buffer'.

 L587:  export type ByteMatchSetUpdates = ByteMatchSetUpdate[];
 L588:  export type ByteMatchTargetString = Buffer|Uint8Array|Blob|string;
 L589:  export interface ByteMatchTuple {

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/config.d.ts, line: 1
Cannot find module 'http'.

   L1:  import {Agent as httpAgent} from 'http';
   L2:  import {Agent as httpsAgent} from 'https';

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/config.d.ts, line: 2
Cannot find module 'https'.

   L1:  import {Agent as httpAgent} from 'http';
   L2:  import {Agent as httpsAgent} from 'https';
   L3:  import {AWSError} from './error';

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts, line: 2
Cannot find module 'stream'.

   L1:  import DynamoDB = require('../../clients/dynamodb');
   L2:  import * as stream from 'stream';
   L3:  import {Request} from '../request';

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts, line: 93
Cannot find name 'Buffer'.

  L93:      export type binaryType = Buffer|File|Blob|ArrayBuffer|DataView|Int8Array|Uint8Array|Uint8ClampedArray|In

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts, line: 197
Cannot find name 'Buffer'.

 L196:  export type BatchWriteItemRequestMap = {[key: string]: WriteRequests};
 L197:  export type BinaryAttributeValue = Buffer|Uint8Array|Blob|string;
 L198:  export type BinarySetAttributeValue = BinaryAttributeValue[];

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/http_response.d.ts, line: 1
Cannot find module 'stream'.

   L1:  import * as stream from 'stream';
   L2:  interface XMLHttpRequest {}

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/http_response.d.ts, line: 14
Cannot find name 'Buffer'.

  L14:  body: string|Buffer|Uint8Array;

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/request.d.ts, line: 1
Cannot find module 'stream'.

   L1:  import * as stream from 'stream';
   L2:  import {Service} from './service';

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/request.d.ts, line: 132
Cannot find name 'Buffer'.

 L132:  on(event: "httpData", listener: (chunk: Buffer|Uint8Array, response: Response<D, E>) => void): Request<D, E>

[23:39:03] typescript: D:/MPA/PoC/gps/node_modules/aws-sdk/lib/services/glacier.d.ts, line: 10
Cannot find name 'Buffer'.

  L10:      computeChecksums(data: Buffer|string): GlacierComputeChecksumsOutput;

Error: Failed to transpile program
at BuildError.Error (native)
at new BuildError (D:\MPA\PoC\gps\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at D:\MPA\PoC\gps\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
at transpileWorker (D:\MPA\PoC\gps\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile (D:\MPA\PoC\gps\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
at D:\MPA\PoC\gps\node_modules\@ionic\app-scripts\dist\build.js:109:82
[23:39:03] copy finished in 13.42 s
PS D:\MPA\PoC\gps>
`

Here is my tsconfig.json file :

{ "compilerOptions": { "allowSyntheticDefaultImports": true, "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "dom", "es2015" ], "module": "es2015", "moduleResolution": "node", "sourceMap": true, "target": "es5", "typeRoots": [ "../node_modules/@types" ] }, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules", "src/**/*.spec.ts", "src/**/__tests__/*.ts" ], "compileOnSave": false, "atom": { "rewriteTsconfig": false } }

I don't know but there isn't any tsconfig.app.json file in 'src' folder (I even tried creating manually and adding configurations like type=["node"], etc But it gave me same error

Can anyone please help me

closing-soon guidance third-party

All 12 comments

@dhawalmewada
That issue looks like what I'd expect if you didn't have node typings installed.

Can you verify that node typings exists for your project? If they don't, you can install them as a dev dependency:
npm install --save-dev @types/node

@chrisradek

It's already there.

image

I even tried removing it and keeping it in tsconfig.app.json (which I manually created) into src folder but nothing helped.

@chrisradek , Following are my version information, in case if you require
var IonicDevServerConfig={"sendConsoleLogs":false,"wsPort":53703,"appScriptsVersion":"3.1.2","systemInfo":["Ionic Framework: 3.9.2","Ionic App Scripts: 3.1.2","Angular Core: 5.0.1","Angular Compiler CLI: 5.0.1","Node: 6.11.4","OS Platform: Windows 10"]};

same has happened to me; trying to resolve it and will report if I find a resolution.

Same problem here! +1

Same problem here :-(

37second and )))

same happened with me

@dhawalmewada

Were you able to get this resolved? I'm curious if you have the same issue with a current version of the SDK and Ionic 2?

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

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.

Was this page helpful?
0 / 5 - 0 ratings