I am trying to launch a modal for my slack app. The modal has to be launched on click of a button from the base message section. I am using slack block builder ( https://www.blockbuilder.dev/) package to construct the json.
The bolt app has the following:
app.action('watch-skill-video', async ({ ack, action, client, say, respond }) => {
ack()
const msg = await watchLayoutBuilder('some value', 'someother value')
console.log('Message - ' + msg)
await respond(JSON.parse(msg))
});
I can see the message getting printed as -
{
"title": {
"type": "plain_text",
"text": "Abc"
},
"submit": {
"type": "plain_text",
"text": "Submit"
},
"blocks": [
{
"text": {
"type": "plain_text",
"text": "Dummy"
},
"type": "button"
}
],
"type": "modal"
}
However along with this, a 404 error is showing up in console ( and off course the popup does not work) !
[ERROR] bolt-app UnknownError: Request failed with status code 404
at asCodedError (/Users/rajeshghosh/Projects/pwa-slack/node_modules/@slack/bolt/dist/errors.js:35:12)
at App.handleError (/Users/rajeshghosh/Projects/pwa-slack/node_modules/@slack/bolt/dist/App.js:608:57)
at App.processEvent (/Users/rajeshghosh/Projects/pwa-slack/node_modules/@slack/bolt/dist/App.js:593:25)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async SocketModeClient.<anonymous> (/Users/rajeshghosh/Projects/pwa-slack/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js:126:17) {
code: 'slack_bolt_unknown_error',
original: Error: Request failed with status code 404
at createError (/.../node_modules/@slack/bolt/node_modules/axios/lib/core/createError.js:16:15)
at settle (/.../node_modules/@slack/bolt/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/.../node_modules/@slack/bolt/node_modules/axios/lib/adapters/http.js:322:11)
at IncomingMessage.emit (events.js:412:35)
at IncomingMessage.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
config: {
transitional: [Object],
adapter: [Function: httpAdapter],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: [Object],
proxy: false,
method: 'post',
url: 'https://hooks.slack.com/actions/TFTS42ALT/3855892288214/7lmakyKKBAvk0paJguVzxoih',
data: '{"title":{"type":"plain_text","text":"Abc"},"submit":{"type":"plain_text","text":"Submit"},"blocks":[{"text":{"type":"plain_text","text":"Dummy"},"type":"button"}],"type":"modal"}'
},
request: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
_header: 'POST /actions/TFTS42ALT/3855892288214/7lmakyKKBAvk0paJguVzxoih HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json\r\n' +
'User-Agent: axios/0.26.1\r\n' +
'Content-Length: 179\r\n' +
'Host: hooks.slack.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/actions/TFTS42ALT/3855892288214/7lmakyKKBAvk0paJguVzxoih',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'hooks.slack.com',
protocol: 'https:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
response: {
status: 404,
statusText: 'Not Found',
headers: [Object],
config: [Object],
request: [ClientRequest],
data: [Object]
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
}
[ERROR] An unhandled error occurred while Bolt processed (type: block_actions, error: Error: Request failed with status code 404)
I am using webhooks. Appreciate any help here !
Btw, If I send a simple message instead of modal, it works fine.