# Using circleci/slack@4.12 with custom base image

**URL:** <https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910>\
**Category:** Orbs\
**Tags:** docker, slack\
**Created:** [April 25, 2023, 3:12pm UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910 "2023-04-25T15:12:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteoannotell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/matteoannotell/32/32881_2.png) [@matteoannotell](https://discuss.circleci.com/u/matteoannotell)\
**Post date:** [April 25, 2023, 3:12pm UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/1 "2023-04-25T15:12:03Z")

</div>

Hi everyone. I have been happily using circleci/slack@4.12 with a convenience python image for quite some time. We are now changing to a custom base image, where we manually install curl and jq, and things seem not to work anymore (see stack below). I am not really sure where to get started for troubleshoot this, any pointers would be greatly appreciated.  
Thanks everyone

* * *

#!/bin/bash -eo pipefail  
#!/usr/bin/env sh

# Workaround for Windows Support

# For details, see:

# shellcheck source=/dev/null

eval printf ‘%s’ “$SLACK\_SCRIPT\_NOTIFY”

Posting Status  
BASH\_ENV file: /tmp/.bash\_env-6447d8cb93d1e71ebc031dc1-0-build  
Exists. Sourcing into ENV  
Checking For JQ + CURL

Exited with code exit status 23  
CircleCI received exit code 23

---

<div class="post-metadata">

**Author:** ![matteoannotell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/matteoannotell/32/32881_2.png) [@matteoannotell](https://discuss.circleci.com/u/matteoannotell)\
**Post date:** [April 25, 2023, 3:31pm UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/2 "2023-04-25T15:31:36Z")

</div>

> [@matteoannotell](#):
>
> circleci/slack@4.12

For context, if i docker run that image locally, i can successfully **curl -d “text=Hi I am a bot that is trying to curl your channel.” -d “channel=” -H “Authorization: Bearer ” -X POST**

---

<div class="post-metadata">

**Author:** ![rit1010](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rit1010/32/34738_2.png) [@rit1010](https://discuss.circleci.com/u/rit1010)\
**Post date:** [April 25, 2023, 7:35pm UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/3 "2023-04-25T19:35:54Z")

</div>

The error code indicates that there is an error with a command that is being executed within the shell. Without more detail, it is not possible to say what is generating the error or what the error means.

For curl error 23 is “Failed writing body” This can be thrown if the output of curl is being buffered and piped to another program that decides that it can close the pipe while curl is still sending data. Using curl’s -o flag can cause the same error if a file is provided that has to be created in a directory that does not yet exist.

---

<div class="post-metadata">

**Author:** ![matteoannotell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/matteoannotell/32/32881_2.png) [@matteoannotell](https://discuss.circleci.com/u/matteoannotell)\
**Post date:** [April 25, 2023, 9:11pm UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/4 "2023-04-25T21:11:54Z")

</div>

Hi Roger, thanks for replying.  
Is there any way i can make the orb more verbose and have a full trace of what goes wrong, or provide more details?

The only reference i have is that this new test step, with curl, works fine:

```
  - run:
      name: "Test notifications" #
      command: |
        curl -X POST \
          -H "Authorization: Bearer $SLACK_ACCESS_TOKEN" \
          -H 'Content-type: application/json' \
          --data "{\"text\":\"Hello :smile:\", \"channel\":\"$SLACK_DEFAULT_CHANNEL\"}" \
          https://slack.com/api/chat.postMessage

```

while the old step using the orb, here below, does not

```
  # - slack/notify:
  # branch_pattern: master
  # channel: CXXXYYYZZZ
  # event: pass
  # template: basic_success_1

```

Really appreciate your help with this

---

<div class="post-metadata">

**Author:** ![rit1010](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rit1010/32/34738_2.png) [@rit1010](https://discuss.circleci.com/u/rit1010)\
**Post date:** [April 26, 2023, 12:25am UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/5 "2023-04-26T00:25:29Z")

</div>

There is no way to make the orb more verbose, but the detail you have provided now allows a good guess at the problem by looking at the orb source code.

Can you check that you have write access to /usr/local/bin, the script seems to want to use curl to download a copy of jq and place it at /usr/local/bin/jq via curl’s -o setting. As this can throw error 23 due to access issues it would be a good place to start.

If you have the time you could validate the issue by taking the code from line 211 of the source code found here

> **[CircleCI Developer Hub - circleci/slack](https://circleci.com/developer/orbs/orb/circleci/slack#orb-source)**
>
> Implement event-based notifications across all of your CI/CD pipelines. Utilizing built-in message templates or Slack's visual Block-Kit builder, create and customize notifications specific to your organization's needs. Supports Linux x86\_64, MacOS,...

and place it in your test step to see what happens in your environment.

---

<div class="post-metadata">

**Author:** ![matteoannotell](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/matteoannotell/32/32881_2.png) [@matteoannotell](https://discuss.circleci.com/u/matteoannotell)\
**Post date:** [April 26, 2023, 8:02am UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/6 "2023-04-26T08:02:27Z")

</div>

> [@rit1010](#):
>
> /usr/local/bin/jq

That was indeed the problem, once I gave user write access to /usr/local/bin, everything started working again. Thanks a lot for the quick and sharp support, much appreciated 🙏

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [May 3, 2023, 8:02am UTC](https://discuss.circleci.com/t/using-circleci-slack-4-12-with-custom-base-image/47910/7 "2023-05-03T08:02:53Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
