# Websocket error when using Sendbird with Saucelabs

**URL:** <https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827>\
**Category:** JavaScript\
**Tags:** sendbird-call, chatsdk\
**Created:** [March 5, 2021, 6:04pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827 "2021-03-05T18:04:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:04pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/1 "2021-03-05T18:04:32Z")

</div>

Issue - Error during WebSocket handshake: ‘Upgrade’ header is missing

I am trying to run my chat application in Sauce labs for e2e testing, After setting up connection with Sauce Labs when i try to open the chat in Saucelabs browser, I am getting `Error during WebSocket handshake: 'Upgrade' header is missing`.

 ![Screen Shot 2021-03-05 at 9.46.44 AM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/0/071d7f4883b6a456b220423bba49f295b1d03d97.jpeg)

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:07pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/2 "2021-03-05T18:07:36Z")

</div>

Hello @premkumar,

Welcome to the Sendbird Community. Can you expand on your implementation? What version of the SDK are you utilizing?

Thanks,  
Tyler

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:09pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/3 "2021-03-05T18:09:59Z")

</div>

Hi Tyler, Thanks for getting back. Currently we are using “sendbird”: “3.0.143”

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:14pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/4 "2021-03-05T18:14:59Z")

</div>

Thank you @premkumar. Could you expand on your implementation? Are you able to share how you’re implementing the Sendbird SDK into your application?

If you run your application outside of SauceLabs, do you run into this issue?

-Tyler

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:17pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/5 "2021-03-05T18:17:00Z")

</div>

![Screen Shot 2021-03-05 at 9.45.55 AM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/d/dd2ff59d2912eef82b947256eaf5fc5d17506e90.png) I dont find any issue running outside the Sauce lab

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:19pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/6 "2021-03-05T18:19:45Z")

</div>

Could you please provide the entire network request that fails in SauceLabs?

Thanks

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:25pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/7 "2021-03-05T18:25:35Z")

</div>

Request URL: wss://ws-18c9516b-cd88-44cc-a6d7-8a4c7c85d1e0.sendbird.com/?p=JS&pv=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2011\_0\_0)%20AppleWebKit%2F537.36%20(KHTML.%20like%20Gecko)%20Chrome%2F87.0.4280.66%20Safari%2F537.36&sv=3.0.143&ai=18C9516B-CD88-44CC-A6D7-8A4C7C85D1E0&user\_id=8fab1c16-e6ab-4d10-ba5a-dc97340ef7a9&access\_token=63103881fec91c9d7ed237bfec33f6b013d18b21&active=1&SB-User-Agent=JS%2Fc3.0.143%2F%2F&Request-Sent-Timestamp=1614968517430&include\_extra\_data=premium\_feature\_list%2Cfile\_upload\_size\_limit%2Capplication\_attributes%2Cemoji\_hash

Response:  
`Error during WebSocket handshake: 'Upgrade' header is missing`

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:32pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/8 "2021-03-05T18:32:15Z")

</div>

Thank you. Could you also provide a screenshot of the following from SauceLabs?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/e/e3263dc9c245735e80428ed045a4de5ce143deae.png)

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:49pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/9 "2021-03-05T18:49:29Z")

</div>

![Screen Shot 2021-03-05 at 12.49.08 PM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/e/ea9a9b3a76a3f67126d519d74b1d40716120fa88.jpeg) here you go

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:50pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/10 "2021-03-05T18:50:41Z")

</div>

Is this the request that fails in SauceLabs?

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:51pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/11 "2021-03-05T18:51:45Z")

</div>

yes this is from Sauce lab

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 6:56pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/12 "2021-03-05T18:56:51Z")

</div>

Could you please export the Chrome HAR file for when the request fails in SauceLabs, and DM me with it?

Thanks!

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 6:58pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/13 "2021-03-05T18:58:46Z")

</div>

I am not able to send it  
Body is limited to 32000 characters; you entered 219949.  
Sorry, new users can only put 2 links in a post.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 7:00pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/14 "2021-03-05T19:00:05Z")

</div>

You should be able to ZIP the HAR file and DM it to me. If that does not work, let me know and we’ll figure out a different solution.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 7:32pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/15 "2021-03-05T19:32:17Z")

</div>

I’m having a difficult time tracking down why SauceLab would be having an issue with the Websocket. Looking at the request headers and comparing them to a successful call from my own environment, they’re nearly identical aside from the origin and key. Can you help me better understand SauceLabs? Is it its own environment? How does it differ from when you’re using the application outside of it?

Thanks,  
Tyler

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 8:23pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/16 "2021-03-05T20:23:55Z")

</div>

I am connecting to Sauce labs using Sauce connect proxy here [Sauce Connect Proxy - The Sauce Labs Cookbook - Sauce Labs Documentation Wiki](https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy)

which sets up a tunnel for sauce lab VM to execute my session in multiple browsers, it works fine for HTTP req, but fails only for WS req with the error shown above.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 8:26pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/17 "2021-03-05T20:26:06Z")

</div>

Out of curiosity, if you navigate to [websocket.org Echo Test - Powered by Kaazing](https://www.websocket.org/echo.html) and connect to websocket while connected to SauceLab, does it connect?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/9/93e7bc50ac44d620907d4e9ac2bb877998589646.png)

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 5, 2021, 8:30pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/18 "2021-03-05T20:30:24Z")

</div>

When i try the same

 ![Screen Shot 2021-03-05 at 2.29.58 PM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/b/b0577caeafdd53e0846d5b20fff3e235202e2508.jpeg)

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [March 5, 2021, 8:31pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/19 "2021-03-05T20:31:52Z")

</div>

And if you look at the network requests in the browser, do you see a similar error? It sounds like the tunnel that you’re using is causing issues with Websocket connections.

---

<div class="post-metadata">

**Author:** ![premkumar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@premkumar](https://community.sendbird.com/u/premkumar)\
**Post date:** [March 9, 2021, 7:29pm UTC](https://community.sendbird.com/t/websocket-error-when-using-sendbird-with-saucelabs/1827/21 "2021-03-09T19:29:01Z")

</div>

Hey Tyler. I was able to fix the issue using  
` sauceConnectOpts: { 'no-ssl-bump-domains': 'all', },`

Thanks for your support.
