Describe your issue here.
x in one of the [ ])x in each of the [ ])Old bug #559 seems to be the same issue, but I can't re-open it.
@slack/client version: 4.12.0
node version: 8.12.0 (npm 6.9.0)
OS version(s): macOS 10.14 Mojave
import { WebClient } from '@slack/client'
const web = new WebClient(process.env.SLACK_TOKEN)
const resp = await web.chat.postMessage(
{
channel: process.env.CHANNEL,
text: "Hello!"
}
)
WARNING in ./node_modules/ws/lib/buffer-util.js
Module not found: Error: Can't resolve 'bufferutil' in '/xyz/node_modules/ws/lib'
@ ./node_modules/ws/lib/buffer-util.js
@ ./node_modules/ws/lib/receiver.js
@ ./node_modules/ws/index.js
@ ./node_modules/@slack/client/dist/RTMClient.js
@ ./node_modules/@slack/client/dist/index.js
@ ./src/handler.ts
WARNING in ./node_modules/ws/lib/validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/xyz/node_modules/ws/lib'
@ ./node_modules/ws/lib/validation.js
@ ./node_modules/ws/lib/receiver.js
@ ./node_modules/ws/index.js
@ ./node_modules/@slack/client/dist/RTMClient.js
@ ./node_modules/@slack/client/dist/index.js
@ ./src/handler.ts
No warnings on build
Hi @alexjurkiewicz 馃憢
Sorry for the trouble. We haven't explicitly supported browser-specific use cases with this package, but I'd still like to help you to get it to work. Are you in fact trying to bundle with webpack for use in the browser?
I think we'll be able to solve this problem with v5.0.0, which is going to be released very soon*. In that release, @slack/client will be separated into a few packages and so you'll be able to require only @slack/web-api if all you need is the WebClient. I haven't tried bundling this new package myself just yet, but if you're willing to give it a shot for us and report back what you find, we'd appreciate it. 馃槃
*Very soon likely means before the end of the week.
Actually, I'm trying to use it in an AWS Lambda with Serverless framework!
To build the full example, you can use these commands:
mkdir slacktest
cd slacktest/
npx sls create -t aws-nodejs-typescript -n slacktest
npm i
npm i @slack/client
Then add this file as handler.ts:
import { APIGatewayProxyHandler } from 'aws-lambda';
import { WebClient } from '@slack/client'
export const hello: APIGatewayProxyHandler = async (event, context) => {
const web = new WebClient(process.env.SLACK_TOKEN)
const slackresp = await web.chat.postMessage(
{
channel: process.env.CHANNEL,
text: "Hello!"
})
const resp = {
statusCode: 200,
body: JSON.stringify(slackresp)
}
return resp
}
And run npx sls package.
So personally I'm not (that) worried about bundle size. But splitting up the package sounds fine!
Most helpful comment
Actually, I'm trying to use it in an AWS Lambda with Serverless framework!
To build the full example, you can use these commands:
Then add this file as
handler.ts:And run
npx sls package.So personally I'm not (that) worried about bundle size. But splitting up the package sounds fine!