bug: Unexpected token 'o', "ok" is not valid JSON
@zimeg đang làm issue này rồi.
Từ ngày 12/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 1.4k
- Fork
- 200
- Merge trung bình
- 1 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/slack-github-action
-
docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
slackapi/slack-github-action#667 ·
-
discussion security semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
slackapi/slack-github-action#621 · 1 bình luận · 1 reaction ·
-
needs info question
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
slackapi/slack-github-action#654 · 7 bình luận · 5 reaction ·
-
question
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
slackapi/slack-github-action#520 · 1 bình luận ·
-
`TypeError: err.toJSON is not a function` when webhook URL is invalidCó thể đã có người làm @saschabuehrle đã nhận 200 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
slackapi/slack-github-action#511 · 2 bình luận · 3 reaction ·
Tất cả issue của slackapi/slack-github-action
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
druxt/umami.demo.druxtjs.org#527 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
NuSkooler/enigma-bbs#907 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
documentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày