slack-notify v1.0.0 now fails on message that previously succeeded
Asked by Shaun Dishman:

We have been using slack-notify to post messages about deployment status. I recently attempted to upgrade from 0.3.6 to 1.0.0, and now an error occurs.

Here is an example message that was working pre-upgrade:

```
[fake/stage]: Deployed stage-v1.1.0-SC21.03.2-clarus-21.03.2 (Shaun Dishman)
```

Do I need to escape the square brackets or something? Or perhaps the forward-slash?

I am attaching a screenshot of the pipeline error.

For now I'm going to downgrade the pipe version, but it's a bit disappointing/frustrating to fail in an unexpected way.

Thanks in advance for assistance.

![bitbucket-pipelines-slack-error.png](https://community.atlassian.com/t5/image/serverpage/image-id/135970i3E49077793136CAF/image-size/large?v=v2&px=999 "bitbucket-pipelines-slack-error.png")


Answers:
author: Halyna Berezovska
body: [@Shaun Dishman](/t5/user/viewprofilepage/user-id/694360)thanks for raising this question!

Could you please, share the pipeline of how you're using the pipe?

It is important for us to see how you pass variables to the pipe. I see root cause can be there.

Regards, Galyna

comments: author: Shaun Dishman
body: I figured you might ask for that. We use it in an \`after-script\` block. I'll just include that block for brevity. If you need the whole pipeline I can provide it, although I think it would just add a lot more noise:

```
after-script: &notify-slack
  - apk add -q --no-progress curl jq
  - export BITBUCKET_TRIGGERER_USERNAME=$(curl -X GET -g "https://api.bitbucket.org/2.0/users/${BITBUCKET_STEP_TRIGGERER_UUID}" | jq --raw-output '.display_name')
  - export BUILD_TAG=$(/root/deploy/deploy_tools/simple/build_tag "$BITBUCKET_CLONE_DIR" "$BITBUCKET_DEPLOYMENT_ENVIRONMENT")
  - if [[ $BITBUCKET_EXIT_CODE -eq 0 ]]; then export MESSAGE="Deployed ${BUILD_TAG}"; else export MESSAGE="Failed deployment of ${BUILD_TAG}"; fi

  - pipe: atlassian/slack-notify:0.3.6
    variables:
      WEBHOOK_URL: $SLACK_WEBHOOK_URL
      MESSAGE: '[${CLIENT_NAME}/${BITBUCKET_DEPLOYMENT_ENVIRONMENT}]: ${MESSAGE} (${BITBUCKET_TRIGGERER_USERNAME})'
      # DEBUG: "true"
```


author: Halyna Berezovska
body: [@Shaun Dishman](/t5/user/viewprofilepage/user-id/694360)yes, that is enough, thanks! I guess I can see the root cause - you're using \`\[\` \`\]\` characters, that are considered as structure.

Looks like this is a bug, starting from 1.0.0 version.

Temporary workaround for you, if you need the pipeline to succeed just right now : you can downgrade to previous versions. Unfortunately, I don't see other options for this case.

I'll notify once we release bugfix for your case.

Regards, Galyna


author: Shaun Dishman
body: Thanks for the investigation. As I mentioned in my initial summary, I've already downgraded back to 0.3.6 and it works fine. But it would be nice to stay abreast of the latest updates, so I'll be interested to hear when a fix comes out.


author: Halyna Berezovska
body: [@Shaun Dishman](/t5/user/viewprofilepage/user-id/694360) could you try use the same version but adding extra quotes? So your variable could look like this:

```
MESSAGE: '"[${CLIENT_NAME}/${BITBUCKET_DEPLOYMENT_ENVIRONMENT}]: ${MESSAGE} (${BITBUCKET_TRIGGERER_USERNAME})"'
```

Thanks! Sorry for late response .

It is the question how pipeline infra is parsing things. In bash scripts they are understood differently, than in python.


author: Shaun Dishman
body: That appears to work. I expected it to show a set of double-quotes in the resultant slack message, but it doesn't.


author: Halyna Berezovska
body: [@Shaun Dishman](/t5/user/viewprofilepage/user-id/694360) yes, because this is the way how pipeline parses the variables. We will update documentation


Tags: bitbucket-pipelines

cloud

slack