Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance error with Slack Node SDK and NCC #33

Closed
ataylorme opened this issue Sep 15, 2020 · 2 comments
Closed

Inheritance error with Slack Node SDK and NCC #33

ataylorme opened this issue Sep 15, 2020 · 2 comments

Comments

@ataylorme
Copy link

ataylorme commented Sep 15, 2020

Hello,
I'm updating dependencies in my project (yay!) but I'm having some issues with the Slack Node SDK and @vercel/ncc.

I am maintaining a serverless function that reacts to interactive Slack messages. I am using the Slack SDK in a TypeScript environment, compiling my code with ncc for deployment to AWS Lambda.

Updating ncc also updates static-eval, which throws a new error when running my compiled Lambda function.

Going through the change logs between the old and new versions I believe this was introduced in #27

The error I am seeing is Error: Attempt to inherit from WebClient methods without inheriting from WebClient

Here is how I am using the Slack SDK:

import {WebClient as SlackWebClient} from '@slack/web-api'
(async () => {
  // The slack token is fetched from SSM
  const {slackToken} = await getSecrets({environment})
  const slackClient = new SlackWebClient(slackToken)
  await slackClient.chat.postMessage({
    channel: channelID,
    thread_ts: messageID,
    text: `Some message text`,
  })
})

which aligns with their Posting a message with Web API documentation

If you can point me in the right direction on how to resolve this I would appreciate it.

@goto-bus-stop
Copy link
Member

Looking at ncc's lockfile, static-eval is only installed through their pdfkit dependency, which is only installed for tests and not for end users. As such, I don't think this error can possibly be related to static-eval.

@ataylorme
Copy link
Author

@goto-bus-stop thanks for the reply. I think you are correct -- I did some more debugging and compiling my code with TypeScript only (without ncc) does not throw this error.

The error comes from the Slack SDK: https://github.com/slackapi/node-slack-sdk/blob/main/packages/web-api/src/methods.ts#L37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants