sst / ion

SST v3
https://sst.dev
MIT License
1.61k stars 211 forks source link

Unable to link Queue handler to Queue #80

Closed VirtuaBoza closed 5 months ago

VirtuaBoza commented 5 months ago

I have this queue, and I want the handler to be able to delete the received queue message. I have this in my run impl:

    const bookEmbeddingQueue = new sst.aws.Queue("BookEmbeddingQueue");
    bookEmbeddingQueue.subscribe({
      handler: "packages/functions/src/consumeBookEmbeddingQueue/handler.main",
      link: [OpenApiKey, NeonDatabaseUrl, bookEmbeddingQueue],
      timeout: "900 seconds",
    });

And after adding bookEmbeddingQueue into the link array, I got this error when running sst dev:

The Pulumi runtime detected that 1533 promises were still active
at the time that the process exited. There are a few ways that this can occur:
  * Not using `await` or `.then` on a Promise returned from a Pulumi API
  * Introducing a cyclic dependency between two Pulumi Resources
  * A bug in the Pulumi Runtime
Leaving promises active is probably not what you want. If you are unsure about
why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
environment variable. The Pulumi runtime will then print out additional
debug information about the leaked promises.
|  Error       

×  Failed

relates to: https://discord.com/channels/983865673656705025/1221105015939272795

ION-228

jayair commented 5 months ago

@fwang can you take a look at this?

fwang commented 5 months ago

@VirtuaBoza i'm able to reproduce on my end. Looking into it.

alexfcosta commented 5 months ago

the same is happening for the subscribe on s3 buckets - if I remove the link then it is possible to deploy (but with no links)

    const myBucket = new sst.aws.Bucket("MyBucket", {
      public: false,
    });
    myBucket.subscribe({
      handler: "src/loadData.handler",
      link: [myBucket, lakeBucket, userTable],
    });
The Pulumi runtime detected that 443 promises were still active
at the time that the process exited. There are a few ways that this can occur:

Not using await or .then on a Promise returned from a Pulumi API
Introducing a cyclic dependency between two Pulumi Resources
A bug in the Pulumi Runtime
Leaving promises active is probably not what you want. If you are unsure about
why you are seeing this message, re-run your program with the PULUMI_DEBUG_PROMISE_LEAKS
environment variable. The Pulumi runtime will then print out additional
debug information about the leaked promises.
|  Error

×  Failed
ghardin1314 commented 5 months ago

Having a similar error when trying to link a Dynamo table to a function subscribing to that table events

  const eventStore = new sst.aws.Dynamo("EventStore", {
      fields: {
        aggregateId: "string",
        version: "number",
        eventStoreId: "string",
        timestamp: "string",
      },
      primaryIndex: {
        hashKey: "aggregateId",
        rangeKey: "version",
      },
      globalIndexes: {
        initialEvents: {
          hashKey: "eventStoreId",
          rangeKey: "timestamp",

          // projection: "keys_only",
        },
      },
      stream: "new-image",
    });

  eventStore.subscribe({
      handler: "apps/api/src/handlers/projector.handler",
      environment: {
        EVENT_BUS_NAME: eventBus.name,
      },
      link: [eventStore],
    });
The Pulumi runtime detected that 2317 promises were still active
at the time that the process exited. There are a few ways that this can occur:
  * Not using `await` or `.then` on a Promise returned from a Pulumi API
  * Introducing a cyclic dependency between two Pulumi Resources
  * A bug in the Pulumi Runtime
Leaving promises active is probably not what you want. If you are unsure about
why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
environment variable. The Pulumi runtime will then print out additional
debug information about the leaked promises.
fwang commented 5 months ago

Fixed in v0.0.254