# Cannot push BalenaSound, 'Cannot set headers after they are sent to the client'

**URL:** <https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767>\
**Category:** Product support\
**Created:** [August 6, 2019, 6:31pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767 "2019-08-06T18:31:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 6:31pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/1 "2019-08-06T18:31:23Z")

</div>

Hello, I am following BalenaSound project and can’t seem to push balena-sound-master files to my device.

After successfully logging in with balena-cli, unzipping balena-sound-master and cd’ing into its folder, I use :

```
balena push application-name

```

After adding debug 1 , this is the output:

```
Debug: original argv0="balena" argv=[/home/mal/balena-cli/balena,/snapshot/versioned-source/bin/balena,push,XXXXXXXXXXX] length=4
[debug] Using . as build source
[debug] Connecting to builder at https://builder.balena-cloud.com/v3/build?owner=gh_XXXXXXX&app=XXXXXXXXX&dockerfilePath=&emulated=false&nocache=false&headless=false
| Uploading source package to balena cloud[debug] received HTTP 200 OK
[debug] handling message: {"type":"metadata","resource":"buildLogId","value":1020819}
[debug] handling message: {"message":"\u001b[31m[Error]\u001b[39m An error occured: Cannot set headers after they are sent to the client","isError":true}
[Error] An error occured: Cannot set headers after they are sent to the client
[debug] handling message: {"message":"\u001b[31m[Error]\u001b[39m Not deploying release.","isError":true}
[Error] Not deploying release.
RemoteBuildFailedError: Remote build failed
    at Bluebird.then (/snapshot/versioned-source/build/utils/remote-build.js:56:23)
    at tryCatcher (/snapshot/versioned-source/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/versioned-source/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise.module.exports.Promise._settlePromise (/snapshot/versioned-source/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise.module.exports.Promise._settlePromise0 (/snapshot/versioned-source/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise.module.exports.Promise._settlePromises (/snapshot/versioned-source/node_modules/bluebird/js/release/promise.js:699:18)
    at _drainQueueStep (/snapshot/versioned-source/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/snapshot/versioned-source/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/snapshot/versioned-source/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/snapshot/versioned-source/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:120:23)

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

```

Note I edited out possibly sensible info as user and device name.

Thank you!

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 6:42pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/2 "2019-08-06T18:42:53Z")

</div>

Hi @mal . Are you trying to push to a localMode development device or to balenaCLoud app on the cloud?  
For the former you need to do:

```auto
balena push devicename.local

```

When pushing on the local network directly to the device, you need to have the `.local` to allow the local IP resolution to find the device.

For the latter you need to do:

```auto
balena push myAppName

```

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 6:45pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/3 "2019-08-06T18:45:21Z")

</div>

I am trying to push to application-name on the balenaCloud app.

I just edited that part of my post as I had written device-name, sorry.

The pasted output corresponds to

`balena push app-name`

Balena cli works well btw. I can list apps and devices etc. And this device and app is up, listed and running well.

But I can’t push, nope.

Thank you @shaunmulligan

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 6:51pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/4 "2019-08-06T18:51:08Z")

</div>

Cool, thanks for the info. I will try reproduce on my side. Can you give me some detail about your laptop OS, the CLI version you are using and how you installed the CLI?

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 6:54pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/5 "2019-08-06T18:54:06Z")

</div>

OS: Linux Mint 19.1 Tessa x86\_64  
DE: Cinnamon 4.0.10

Balena CLI: 11.7.5

The Cli I’ve just downloaded, unzipped and added to PATH. Then I successfully logged in with ‘balena login’

Is there anything else I can provide you with?

Oh, btw, as suggested during the balena sound tutorial, the ISO I downloaded had developer mode enable.

Thank you @shaunmulligan

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 6:58pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/6 "2019-08-06T18:58:27Z")

</div>

Thanks @mal that should be good for now.

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:01pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/7 "2019-08-06T19:01:21Z")

</div>

Thank you,

May I ask when may it be that you people take a look at it and answer? Of course this is a public tutorial and I am not expecting (free) premium support, just asking.

Thanks again

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 7:03pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/8 "2019-08-06T19:03:49Z")

</div>

I am actually working on reproducing it now, so we will see if I hit the same issue and then go from there. I assume this is the first time you are pushing code to balena right?

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:05pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/9 "2019-08-06T19:05:53Z")

</div>

That is correct, I just signed up, burned your iso using your etcher. Then followed instructions for balena cli, etc.

So first time everything.

I saw in the dashboard I can provide your people access to the device, let me know if you need that.

Thank you

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:10pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/10 "2019-08-06T19:10:50Z")

</div>

May not be relevant, but I just tried to push using sudo, same error.

Thanks

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 7:13pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/11 "2019-08-06T19:13:00Z")

</div>

Hi @mal , I recreated your issue, it seems we introduced a bug in the latest version of the CLI. If you install `v11.7.4` it should work correctly.

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:13pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/12 "2019-08-06T19:13:36Z")

</div>

A-há!

Oook, I’ll do that and report back

Thank you

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:19pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/13 "2019-08-06T19:19:20Z")

</div>

```
            \
		     \
		      \\
		       \\
		        >\/7
		    _.-(6' \
		   (=___._/` \
		        ) \ |
		       / / |
		      / > /
		     j < _\
		 _.-' : ``.
		 \ r=._\ `.
		<`\\_ \ .`-.
		 \ r-7 `-. ._ ' . `\
		  \`, `-.`7 7) )
		   \/ \| \' / `-._
		              || .'
		               \\ (
		                >\ >
		            ,.-' >.'
		           <.'_.''
		             <'
```

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 7:30pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/14 "2019-08-06T19:30:43Z")

</div>

Great stuff @mal

---

<div class="post-metadata">

**Author:** ![mal](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mal](https://forums.balena.io/u/mal)\
**Post date:** [August 6, 2019, 7:42pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/16 "2019-08-06T19:42:02Z")

</div>

@shaunmulligan thanks again

I’ve just reached balena because of this project, now that it is running (quite well ) I am wondering about balena in general.

I haven’t used Docker yet. I am wondering, can I actually install regular linux packages/apps into a Docker container and run them alongside this bluetooth receiver project via SSH?

I’ve ssh’ed into the rpi from the dashboard, apt-get is not there.

Feel free to direct me to docs or make me open a new thread.  
Thanks

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [August 6, 2019, 8:56pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/17 "2019-08-06T20:56:21Z")

</div>

Hi @mal , I would recommend starting from [https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/](https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/) . You can install regular package in the container, to install these you would add them to your `Dockerfile.template` (think of it a recipe that builds the userspace) . You can also test install from ssh in the container but i think you would need to run `apt-get update && apt-get install wget` , but note that anything installed via SSH at run time will not persist or be saved to the image. you need to install things via Dockerfile to make them reproducible and persistent.

---

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [August 8, 2019, 8:14pm UTC](https://forums.balena.io/t/cannot-push-balenasound-cannot-set-headers-after-they-are-sent-to-the-client/23767/19 "2019-08-08T20:14:27Z")

</div>

FYI, with regard to the issue with CLI version 11.7.5 (which required you to install v11.7.4), I understand the issue was actually with the backend (image builders) rather than the CLI, and it has been fixed. Using the [latest CLI version](https://github.com/balena-io/balena-cli/releases) should now be OK.
