Hi all. I'm struggling with something that seems l...
# general
Hi all. I'm struggling with something that seems like a pretty simple variation on an example from the docs. I'd appreciate any help if you see where I'm going wrong. I'm trying to create a "Fire & Forget" task using a CloudWatch event and a FargateTaskDefinition. I'm basing my attempt on this example: https://www.pulumi.com/docs/guides/crosswalk/aws/ecs/#running-fire-and-forget-tasks So, here's what I have:
Copy code
// create  cluster
const cluster = new awsx.ecs.Cluster(`cluster`, {
  name: `demo-cluster`

// create image
const img = awsx.ecs.Image.fromDockerBuild(`image`, {
  context: './app',

// create task
const task = new awsx.ecs.FargateTaskDefinition(`task`, {
  container: {
    image: img,
    memoryReservation: 2048

// create the cloudwatch event and lambda function using the "onSchedule" helper function
aws.cloudwatch.onSchedule(`task-schedule`, 'rate(5 minutes)',
  async (req) => {
    // run the task in our cluster
    const result = await task.run({cluster});
    return { statusCode: 200, body: "OK" };
Everything seems to build and deploy to AWS correctly. I see the Lambda function, CloudWatch event, logs, task definition, etc. It's all there and linked up. And when I look at my CloudWatch logs for that Lambda function, I see that it's attempting to run every 5 minutes. However, I'm getting this error when it runs:
Copy code
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module '@pulumi/awsx/ecs/index.js'\nRequire stack:\n- /var/task/__index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "stack": [
    "Runtime.ImportModuleError: Error: Cannot find module '@pulumi/awsx/ecs/index.js'",
    "Require stack:",
    "- /var/task/__index.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
    "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:955:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)",
    "    at Module.load (internal/modules/cjs/loader.js:811:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:723:14)",
    "    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)",
    "    at internal/main/run_main_module.js:17:11"
During the Pulumi "magic" of packaging and building the Lambda handler, it looks like it's telling Lambda to look for some Pulumi modules that aren't installed. Any ideas on why this is happening? Thank you, thank you!!