title: I'm having a issue with trading Bot on Heroku, I can run this code on my local and send orders fine but, when uploaded gets a JSONDecodeError
body: <p>This is the error code I am getting when deployed to Heroku. On my local machine, it is not throwing any errors and executes just fine. I am a bit new to going about requests with JSON, so any help would be appreciated.</p>
  <p>This bot was working just fine for months and now it's not executing orders on its own. I'm stumped. This is the code for the bot that's executing the orders. It's getting stuck at the &quot;data = json.loads(request.data)&quot;, I never changed anything before, and it started to do this about a couple of weeks ago.</p>
  <pre><code>```
  import json, config
  from flask import Flask, request, jsonify
  from binance.client import Client
  from binance.enums import *
  from binance.exceptions import BinanceAPIException, BinanceOrderException
  
  app = Flask(__name__)
  client = Client(config.API_KEY, config.API_SECRET, tld='us')
  
  ### This needs to stay the same, this is the order BinanceUS is going to do. ###
  def order(side, quantity, symbol, order_type=ORDER_TYPE_MARKET):
      try:
          print(f&quot;sending order {order_type} - {side} {quantity} {symbol}&quot;)   
          order = client.create_order(symbol=symbol, side=side, type=order_type, quantity=quantity)
      except Exception as e:
          print(&quot;an exception occured - {}&quot;.format(e))
          return False
  
      return order
  ### This is where the webhook conection is and makes sure your Passphrase is correct. (Check 
  Config.py File) ###
  @app.route('/webhook', methods=['POST'])
  def webhook():
      #print(request.data)
      #data = request.get_json()
      data = json.loads(request.data)
  
      if data['passphrase'] != config.WEBHOOK_PASSPHRASE:
          return {
              &quot;code&quot;: &quot;Error, Wrong Passphrase&quot;,
              &quot;message&quot;: &quot;Not Today! Try again&quot;
          }
  
  ### Prints out Token Ticker and Time the trade happened into the console. ###
      print(data['ticker'])
      print(data['time'])
  
      side = data['strategy']['order_action'].upper()
  
  ###  This is the amount of tokens you want ot trade or . ###
      #quantity = 0.50
      quantity = data['strategy']['order_contracts']
  
  ### This is for the Coin/Token you want to trade, Only change the &quot;ETHUSD&quot;. Has to be the right 
  pair. (BTCUSD/BTCUSDT ext.) ###
      order_response = order(side, quantity, &quot;ETHUSD&quot;)
  
      print(order_response)
  
      if order_response:
          return {
              &quot;message&quot;: &quot;You made it&quot;,
              &quot;message&quot;: &quot;Order Executed&quot;,
              &quot;message&quot;: order_response
          }
      else: 
          print(&quot;Error&quot;)
  
          return {
              &quot;message&quot;: &quot;Order Not Fulfilled!&quot;,
              &quot;message&quot;: order_response
          }
  </code></pre>
  <pre><code>
      `[2021-11-14 20:23:43,912] ERROR in app: Exception on /webhook [POST]
      2021-11-14T20:23:43.912775+00:00 app[web.1]: Traceback (most recent call last):
      2021-11-14T20:23:43.912776+00:00 app[web.1]:   File &quot;/app/.heroku/python/lib/python3.9/site-            
      packages/flask/app.py&quot;, line 2070, in wsgi_app
      2021-11-14T20:23:43.912776+00:00 app[web.1]:     response = self.full_dispatch_request()
      2021-11-14T20:23:43.912776+00:00 app[web.1]:   File &quot;/app/.heroku/python/lib/python3.9/site- 
      packages/flask/app.py&quot;, line 1515, in full_dispatch_request
      2021-11-14T20:23:43.912776+00:00 app[web.1]:     rv = self.handle_user_exception(e)
      2021-11-14T20:23:43.912777+00:00 app[web.1]:   File &quot;/app/.heroku/python/lib/python3.9/site- 
      packages/flask/app.py&quot;, line 1513, in full_dispatch_request
      2021-11-14T20:23:43.912777+00:00 app[web.1]:     rv = self.dispatch_request()
      2021-11-14T20:23:43.912777+00:00 app[web.1]:   File &quot;/app/.heroku/python/lib/python3.9/site- 
      packages/flask/app.py&quot;, line 1499, in dispatch_request
      2021-11-14T20:23:43.912777+00:00 app[web.1]:     return 
      self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
      2021-11-14T20:23:43.912777+00:00 app[web.1]:   File &quot;/app/app.py&quot;, line 27, in webhook
      2021-11-14T20:23:43.912777+00:00 app[web.1]:     data = json.loads(request.data)
      2021-11-14T20:23:43.912778+00:00 app[web.1]:   File 
      &quot;/app/.heroku/python/lib/python3.9/json/__init__.py&quot;, line 346, in loads
      2021-11-14T20:23:43.912778+00:00 app[web.1]:     return _default_decoder.decode(s)
      2021-11-14T20:23:43.912778+00:00 app[web.1]:   File 
      &quot;/app/.heroku/python/lib/python3.9/json/decoder.py&quot;, line 337, in decode
      2021-11-14T20:23:43.912778+00:00 app[web.1]:     obj, end = self.raw_decode(s, idx=_w(s, 
      0).end())
      2021-11-14T20:23:43.912779+00:00 app[web.1]:   File 
      &quot;/app/.heroku/python/lib/python3.9/json/decoder.py&quot;, line 353, in raw_decode
      2021-11-14T20:23:43.912779+00:00 app[web.1]:     obj, end = self.scan_once(s, idx)
      2021-11-14T20:23:43.912779+00:00 app[web.1]: json.decoder.JSONDecodeError: Invalid control 
      character at: line 13 column 29 (char 316)
      2021-11-14T20:23:43.913295+00:00 app[web.1]: 10.1.47.231 - - [14/Nov/2021:20:23:43 +0000] &quot;POST 
      /webhook HTTP/1.1&quot; 500 290 &quot;-&quot; &quot;Go-http-client/1.1&quot;
      `
  </code></pre>