https://pulumi.com logo
#typescript
Title
# typescript
g

great-sunset-355

11/08/2023, 11:10 AM
Any idea why am I getting typescript errors?
error TS2339: Property 'send' does not exist on type 'ECSClient'
when I run
pulumi preview
but everything is fine in IDE
Copy code
import {ECSClient,ListServicesCommand} from "@aws-sdk/client-ecs";
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
const clusterName = "myCluster"
const myService = "myService"
const ecsClientPromise = aws.getRegion(undefined, { parent: this }).then((r) => new ECSClient({ region: r.name }))

const serviceArn = ecsClientPromise.then(async (ecsClient) => { 

  const listServicesOutput = await ecsClient.send(new ListServicesCommand({
    cluster: clusterName,
  }))

  const serviceArn = listServicesOutput.serviceArns?.find((f: string)=>f.match(new RegExp(myService, 'g')))
  return serviceArn
});
pulumi.all([serviceArn]).apply(console.log)
p

purple-printer-9748

11/08/2023, 11:20 AM
First, it would be good to paste those errors 🙂 But as I pasted this in my IDE I clearly see some missing imports marked as red (I'm actually using PHP Storm, so Jetbrains IDE family)
g

great-sunset-355

11/08/2023, 11:27 AM
thanks for pointing it out,
p

purple-printer-9748

11/08/2023, 12:04 PM
nice, good catch
g

great-sunset-355

11/08/2023, 12:13 PM
it was not fix sadly
Because I am using
pnpm
I had to hoist
@aws-sdk
and
@smithy