slackapi / node-slack-sdk

Slack Developer Kit for Node.js
https://slack.dev/node-slack-sdk
MIT License
3.26k stars 656 forks source link

'process is not defined' in react vite #1758

Closed 9yujin closed 3 months ago

9yujin commented 3 months ago

(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)

Packages:

Select all that apply:

Reproducible in:

The Slack SDK version

"@slack/web-api": "^7.0.2",

OS info

macOS 14.3(23D56)

Steps to reproduce:

I just tried to init Webclient object.

import { WebClient } from '@slack/web-api';

const token = import.meta.env.VITE_APP_SLACK_TOKEN;
const channelId = 'C06P5BXS08M';

const client = new WebClient(token);

Expected result:

(Tell what you expected to happen) run well

Actual result:

스크린샷 2024-03-16 오후 12 47 35 스크린샷 2024-03-16 오후 12 47 01

with white screen

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

seratch commented 3 months ago

Hi @9yujin, thanks for asking the question!

This SDK is specifically built for Node.js runtime environement, therefore, it does not work for web-browser JS runtime for its several apsects. If you're trying to perform a Slack web API call within such an environment, my personal project should be helpful for it: https://github.com/seratch/slack-web-api-client This library does not rely on any Node.js specific APIs. Please note that if you reveal xoxb-/xoxp- tokens in your web-browser runtime, there is always a ceritan risk of the token exposure to malicious 3rd party attackers. We hightly recomend using those tokens only on the server-side.

Since we don't have anything else to share on your use case (meaning this SDK does not support it), let me close this issue now. Thanks again for posting the question!