Skip to content

[3.0.4][Regression] SlackError: Invalid input! Failed to parse contents of the provided payload #637

Description

@AviVahl

We use slackapi/slack-github-action@v3 to notify our slack on deployments.
Started getting the following with v3.0.4:

SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
    at JSON.parse (<anonymous>)

    at Content.getContentPayload (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/content.js:91:1)
file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/content.js:96
      throw new SlackError(
^
SlackError: Invalid input! Failed to parse contents of the provided payload
    at Content.getContentPayload (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/content.js:96:1)
    at Content.get (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/content.js:28:1)
    at new Config (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/config.js:127:1)
    at send (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/send.js:12:1)
    at file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/index.js:9:1
    at __nccwpck_require__.a (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/runtime/async module:49:1)
    at Object.9722 (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/dist/index.js:48450:21)
    at __nccwpck_require__ (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/bootstrap:21:1)
    at file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/startup:4:1
    at ModuleJob.run (node:internal/modules/esm/module_job:439:25)
    at Content.get (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/content.js:28:1)
    at new Config (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/config.js:127:1)
    at send (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/send.js:12:1)
    at file:///home/runner/work/_actions/slackapi/slack-github-action/v3/src/index.js:9:1
    at __nccwpck_require__.a (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/runtime/async module:49:1)
    at Object.9722 (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/dist/index.js:48450:21)
    at __nccwpck_require__ (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/bootstrap:21:1)
    at file:///home/runner/work/_actions/slackapi/slack-github-action/v3/webpack/startup:4:1
YAMLException: deficient indentation (4:1)

 1 | channel: ***
 2 | text: "✅ *api-server:latest* pub ...
 3 | 
 4 | <https://github.com/dazl-dev/api ...
-----^
    at throwErrorAt (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:889:1)
    at throwError (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:1487:1)
    at readFlowScalarBreak (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:1638:1)
    at readDoubleQuotedScalar (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:1696:1)
    at parseNode (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:2075:1)
    at readBlockMapping (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:1999:1)
    at parseNode (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:2065:1)
    at readDocument (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:2154:1)
    at parseEvents (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:2194:1)
    at loadDocuments (file:///home/runner/work/_actions/slackapi/slack-github-action/v3/node_modules/js-yaml/dist/js-yaml.mjs:2215:1)

We suspect the following PR caused the regression: #635
v3.0.3 worked fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiscussiondocsImprovements or additions to documentation

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions