Major Changes
-
fc98c8c: Drop Node.js 18 support. The minimum supported Node.js version is now 20.
-
fc98c8c: Error classes now extend a new
SlackOAuthErrorabstract base class (which extendsError), bringing@slack/oauthin line with the error handling in@slack/web-apiand@slack/webhook. You can catch any error thrown by this package withif (error instanceof SlackOAuthError), in addition to the existing per-classinstanceofchecks (AuthorizationError,InstallerInitializationError, etc.).AuthorizationErrornow populates the standardError.causeproperty with the underlying error when one is available (for example, the failure that causedauthorize()to reject). The existingoriginalproperty is still present and carries the same value.import { AuthorizationError } from "@slack/oauth"; try { await installer.authorize({ teamId, enterpriseId }); } catch (error) { if (error instanceof AuthorizationError) { console.log(error.cause); // the underlying error console.log(error.original); // same value — kept for backward compat } }
The
error.codeproperty andErrorCodeenum values are unchanged, so existingerror.codechecks continue to work. TheCodedErrorinterface is retained (it is part of the publicCallbackOptions#failurecallback signature), but for new code we recommendinstanceofchecks againstSlackOAuthErroror a specific subclass.Note:
error.namenow reflects the specific class name (e.g.'AuthorizationError') instead of the generic'Error'. If you branch onerror.name, update those checks accordingly. -
fc98c8c: Updated the internal
@slack/web-apidependency from^7to^8. If you passclientOptionstoInstallProvider, the following options are no longer available:clientOptions.agent— UseclientOptions.fetchwith a custom fetch implementation instead.clientOptions.tls— Configure TLS viaclientOptions.fetchor theNODE_EXTRA_CA_CERTSenvironment variable.
import { InstallProvider } from "@slack/oauth"; import { fetch, Agent } from "undici"; const installer = new InstallProvider({ clientId: process.env.SLACK_CLIENT_ID, clientSecret: process.env.SLACK_CLIENT_SECRET, stateSecret: "my-secret", clientOptions: { fetch: (url, init) => fetch(url, { ...init, dispatcher: new Agent({ connect: { ca: myCA } }), }), }, });
See the
@slack/web-apiv8 changelog for the full list of breaking changes that affectclientOptions.