raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.37k stars 3.06k forks source link

[Slack] Worker terminated due to reaching memory limit #13067

Closed LewisLebentz closed 2 months ago

LewisLebentz commented 4 months ago

Extension

https://www.raycast.com/mommertf/slack

Raycast Version

1.77.1

macOS Version

14.6

Description

I tried creating a Raycast app with a app manifest directly in Slack and also using the pre-made Slack app (believe that was newly added). With both no functionality works.

The error log shows this:

Error: Worker terminated due to reaching memory limit: JS heap out of memory

NodeError:errors:406:5
[kOnExit]:worker:313:26
Worker.<computed>.onexit:worker:229:20

I haven't done too much troubleshooting, but I've developed Slack integrations before and as I've been using Slack for a long time I wonder if i have too many messages/chats so it can't handle it?

Also using Enterprise Grid.

Steps To Reproduce

  1. Create Slack app with manifest
  2. Install to workspace
  3. Copy xoxp- key into the extension
  4. Try to search or read unread messages - nothing works

Current Behaviour

No response

Expected Behaviour

No response

raycastbot commented 4 months ago

Thank you for opening this issue!

🔔 @momme-rtf @Elliot67 @jfkisafk @thomaslombart you might want to have a look.

💡 Author and Contributors commands The author and contributors of `mommertf/slack` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopens the issue. - `@raycastbot assign me` Assigns yourself to the issue. - `@raycastbot good first issue` Adds the "Good first issue" label to the issue. - `@raycastbot keep this issue open` Make sure the issue won't go stale and will be kept open by the bot.
thomaslombart commented 4 months ago

Could you share a recording? It'll make it easier to see what's happening.

LewisLebentz commented 4 months ago

@thomaslombart don't have my Mac with me at the moment, probably won't be able to send anything until tomorrow.

But literally nothing happens. I did a quick GitHub search and it seems like this memory issue is quite widespread across multiple extensions wherever it is processing a large amount of data.

Elliot67 commented 4 months ago

Very likely an issue with large workspace : #4284

When pulling data from the Slack API, the extension doesn't stop pulling until it gets every users, channels and messages.

jfkisafk commented 4 months ago

The optimal solution would be to replace pagination like these:

https://github.com/raycast/extensions/blob/5c077f5a72c66ae6caab0a5958f4d89fb30c86df/extensions/slack/src/shared/client/SlackClient.ts#L84-L94

with:

  1. (recommended) just retrieve the first page and support typeahead search. We will need to explore if all the APIs support a search pattern to restrict the results. For example, can't find it for https://api.slack.com/methods/users.list
  2. raycast native pagination and a typeahead search. But unless we figure out an API that supports typeahead search pattern, I think users of large workspaces will need to keep scrolling down to retrieve all items and search.
raycastbot commented 2 months ago

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot commented 2 months ago

This issue has been automatically closed due to inactivity.

Feel free to comment in the thread when you're ready to continue working on it 🙂

You can also catch us in Slack if you want to discuss this.