오류
/home/ubuntu/.pm2/logs/index-error.log last 15 lines:
0|index | code: 'slack_bolt_app_initialization_error'
0|index | }
0|index | AppInitializationError: You must provide an appToken when socketMode is set to true. To generate an appToken see: https://api.slack.com/apis/connections/socket#token
0|index | at App.initReceiver (/home/ubuntu/Do-IT/node_modules/@slack/bolt/dist/App.js:629:23)
0|index | at new App (/home/ubuntu/Do-IT/node_modules/@slack/bolt/dist/App.js:140:30)
0|index | at Object.<anonymous> (/home/ubuntu/Do-IT/slack.js:12:17)
0|index | at Module._compile (node:internal/modules/cjs/loader:1256:14)
0|index | at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
0|index | at Module.load (node:internal/modules/cjs/loader:1119:32)
0|index | at Module._load (node:internal/modules/cjs/loader:960:12)
0|index | at Module.require (node:internal/modules/cjs/loader:1143:19)
0|index | at Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
0|index | at require (node:internal/modules/cjs/helpers:121:18) {
0|index | code: 'slack_bolt_app_initialization_error'
0|index | }
Slack의 Socket Mode를 사용하려면 appToken을 제공해야 한다고 나타난 오류이다.
해결 과정
EC2 환경 변수 설정
cd ~
vim .bash_profile
export SLACK_BOT_TOKEN =
export SLAC_SIGNING_SECRET =
export CHANNEL_ID =
export WEB_HOOK_URI =
export SLACK_APP_TOKEN =
.bash_profile에 Slackbot 관련 정보를 입력한다.
esc
정보를 입력한 후, esc 버튼을 누른다.
:wq
:wq를 입력하면, 입력한 정보가 저장된다.
source .bash_profile
.bash_profile 파일의 변경사항이 저장된다.