bug: Unexpected token 'o', "ok" is not valid JSON
@zimeg がすでに取り組んでいます。
2026年8月12日 から。
評価
この issue はまだ評価されていません。
説明
Hello and thank you for this action Slack!
Already done a search in both open and closed issues but found none matching my problem. Also looked for open PRs and none fix it either.
When running the GitHub action to notify on failed workflows, as in:
name: Check-Workflow
on:
workflow_run:
workflows: ["*"]
branches: [main]
types:
- completed
jobs:
notify:
runs-on: ubuntu-latest-small
if: github.event.workflow_run.conclusion == 'failure'
permissions:
contents: read
steps:
- name: Slack alert for failure on main
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.1
with:
errors: true
webhook: ${{ secrets.WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
text: "valid text"
It fails with the following error: Error: SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
Full stacktrace is:
Error: SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57
throw new SlackError(config.core, err.message);
^
SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
at Webhook.post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57:1)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:34:1)
at send (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:14:1)
at file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/index.js:9:1
Error: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
SlackError: A request error occurred: Unexpected token 'o', "ok" is not valid JSON
at Webhook.post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/webhook.js:57:1)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at post (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:34:1)
at send (file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/send.js:14:1)
at file:///home/runner/_work/_actions/slackapi/slack-github-action/dcb1066f776dd043e64d0e8ba94ca15cc7e1875d/src/index.js:9:1
Some small research with Claude mentioned the following on why it failed:
1. The Slack action posts to the webhook — Slack actually receives it and responds with ok (plain text).
2. But the action expects JSON back, parses "ok" as JSON → Unexpected token 'o', "ok" is not valid JSON.
Hope this is enough context 🤞
Thank you
- 主要言語
- JavaScript
- スター
- 1.3k
- フォーク
- 200
- 平均マージ
- 2時間 59分
- マージ済み PR(30日)
- 6
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
slackapi/slack-github-action のほかの issue
-
docs
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
slackapi/slack-github-action#667 ·
-
discussion security semver:major
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
slackapi/slack-github-action#621 · コメント 1 件 · リアクション 1 件 ·
-
needs info question
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
slackapi/slack-github-action#654 · コメント 7 件 · リアクション 5 件 ·
-
question
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
slackapi/slack-github-action#520 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
slackapi/slack-github-action#511 · コメント 2 件 · リアクション 3 件 ·
slackapi/slack-github-action の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
solana-foundation/solana-com#2202 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
yegor256/copyrights-action#216 ·
-
[BUG] onScroll never refreshes the window container's height after a vertical-only viewport resizeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
juliangarnier/anime#1192 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
PedestrianDynamics/pyFDS-Evac#226 ·
メンテナーはふだん 1 日以内に返信