{"id":12040,"library":"slack-edge","title":"Slack Edge Framework","description":"This library, currently at version 1.3.16, provides a framework for building Slack applications optimized for edge runtimes like Cloudflare Workers, Vercel Edge Functions, and Supabase Edge Functions. It also supports Deno, Bun, and Node.js. `slack-edge` emphasizes TypeScript support, offering enhanced type safety for Slack events and API interactions. It differentiates itself from Slack's Bolt framework by being specifically designed for edge environments, including out-of-the-box support for \"lazy listeners\" for asynchronous processing, similar to Bolt-Python. The project maintains a frequent release cadence, primarily focusing on bug fixes, dependency upgrades, and support for new Slack API event types. A key aspect is its minimal dependency footprint, relying primarily on `slack-web-api-client` for Slack API interactions. This design choice contributes to faster cold starts and lower resource consumption, making it ideal for serverless and edge computing architectures.","status":"active","version":"1.3.16","language":"javascript","source_language":"en","source_url":"https://github.com/slack-edge/slack-edge","tags":["javascript","Slack","ChatBot","TypeScript","Deno","Bun","Edge Functions","Cloudflare","Cloudflare Workers","typescript"],"install":[{"cmd":"npm install slack-edge","lang":"bash","label":"npm"},{"cmd":"yarn add slack-edge","lang":"bash","label":"yarn"},{"cmd":"pnpm add slack-edge","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core client for interacting with the Slack API.","package":"@slack/web-api-client","optional":false},{"reason":"Provides Cloudflare Workers specific features and environment setup; required for Cloudflare deployments.","package":"slack-cloudflare-workers","optional":true},{"reason":"Provides Vercel Edge Functions specific features and environment setup; required for Vercel deployments.","package":"slack-vercel-edge","optional":true},{"reason":"Provides Deno specific features and environment setup; required for Deno deployments.","package":"slack-deno","optional":true},{"reason":"Provides Bun specific features and environment setup; required for Bun deployments.","package":"slack-bun","optional":true},{"reason":"Provides Node.js specific features and environment setup; required for Node.js deployments.","package":"slack-node","optional":true}],"imports":[{"note":"The primary class for initializing and configuring your Slack application. While platform-specific adapters may re-export it, the core class is directly from 'slack-edge'.","wrong":"const SlackApp = require('slack-edge');","symbol":"SlackApp","correct":"import { SlackApp } from 'slack-edge';"},{"note":"A type definition for generic environment variables expected by the SlackApp. For platform-specific environments (e.g., Cloudflare Workers), use the types provided by the respective adapter package.","wrong":"import { SlackEnv } from 'slack-edge';","symbol":"SlackEnv","correct":"import type { SlackEnv } from 'slack-edge';"},{"note":"A type definition for asynchronous event handlers that run outside the initial 3-second Slack response window.","wrong":"import { LazyListener } from 'slack-edge';","symbol":"LazyListener","correct":"import type { LazyListener } from 'slack-edge';"},{"note":"Type for errors that include a specific error code, useful for handling API failures or internal framework errors.","wrong":"import { CodedError } from 'slack-edge';","symbol":"CodedError","correct":"import type { CodedError } from 'slack-edge';"}],"quickstart":{"code":"import { SlackApp } from \"slack-edge\";\nimport { SlackEdgeAppEnv } from \"slack-cloudflare-workers\";\n\nexport default {\n  async fetch(\n    request: Request,\n    env: SlackEdgeAppEnv,\n    ctx: ExecutionContext\n  ): Promise<Response> {\n    // Initialize the SlackApp with environment variables provided by the adapter\n    const app = new SlackApp({ env })\n      .command(\"/hello-cf-workers\",\n        async (req) => {\n          // Synchronous handler, responsible for acknowledging the request within 3 seconds\n          return \":wave: This app runs on Cloudflare Workers!\";\n          // If no immediate response is needed, simply `async () => {}` works\n        },\n        async ({ context: { respond } }) => {\n          // Lazy listener, executed asynchronously for longer-running tasks\n          // This can take more than 3 seconds without timing out the initial request\n          await respond({ text: \"This is an async reply. How are you doing?\" });\n        }\n      );\n    // Run the app using the Cloudflare Workers adapter's `run` method\n    return await app.run(request, ctx);\n  }\n};\n\n// --- Local Development Environment Variables (e.g., in .dev.vars) ---\n// SLACK_SIGNING_SECRET=...\n// SLACK_BOT_TOKEN=xoxb-...\n// SLACK_LOGGING_LEVEL=DEBUG","lang":"typescript","description":"Demonstrates a basic Slack app on Cloudflare Workers, handling a slash command. It uses `slack-edge`'s core `SlackApp` and integrates with `slack-cloudflare-workers` to manage the edge function request/response lifecycle, showcasing both synchronous acknowledgment and asynchronous lazy listeners."},"warnings":[{"fix":"Offload all long-running tasks to 'lazy listeners' (the optional third argument in event handlers). These execute asynchronously, allowing the initial request to be acknowledged promptly.","message":"Edge functions have strict execution time limits (typically 3 seconds for initial Slack event responses). Any long-running operations in your synchronous handlers will cause timeouts.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install the appropriate adapter package for your chosen runtime environment and follow its documentation for proper integration, as shown in the quickstart for Cloudflare Workers.","message":"Direct usage of `slack-edge` for an edge runtime requires installing and configuring a platform-specific adapter package (e.g., `slack-cloudflare-workers`, `slack-vercel-edge`) to handle the request/response context.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure `oidc.start` is used for OpenID Connect (OIDC) endpoint customization. Upgrade to version 1.3.8 or later to resolve this bug.","message":"Prior to version 1.3.8, there was a bug where `oauth.start` might have been incorrectly used for OIDC endpoint customization, potentially leading to misconfiguration.","severity":"gotcha","affected_versions":"<1.3.8"},{"fix":"Always verify that all required Slack app environment variables are correctly set in your deployment environment and, for local development, in a `.dev.vars` file or equivalent.","message":"Incorrect or missing Slack environment variables (`SLACK_SIGNING_SECRET`, `SLACK_BOT_TOKEN`, etc.) are a very common cause of application startup failures or request validation errors, especially during local development.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"error":"HTTP 401: Invalid Signature"},{"error":"Signature verification failed"},{"error":"TypeError: app.run is not a function"},{"error":"Request timed out"},{"error":"ReferenceError: process is not defined"}],"ecosystem":"npm"}