pynetbox icon indicating copy to clipboard operation
pynetbox copied to clipboard

Got not "enough values to unpack" error when pass additional headers

Open jinsiang2008 opened this issue 2 years ago • 2 comments

Trying to create webhook with additional headers, but got the error below.

Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.9/site-packages/rq/worker.py", line 1061, in perform_job
    rv = job.perform()
  File "/opt/netbox/venv/lib/python3.9/site-packages/rq/job.py", line 821, in perform
    self._result = self._execute()
  File "/opt/netbox/venv/lib/python3.9/site-packages/rq/job.py", line 844, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/opt/netbox/netbox/extras/webhooks_worker.py", line 58, in process_webhook
    raise e
  File "/opt/netbox/netbox/extras/webhooks_worker.py", line 55, in process_webhook
    headers.update(webhook.render_headers(context))
  File "/opt/netbox/netbox/extras/models/models.py", line 166, in render_headers
    header, value = line.split(':', 1)
ValueError: not enough values to unpack (expected 2, got 1)

The header I added was simple, just an authorization header

Authorization:
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3NDcwMDgwMDAsInN1YiI6Im5ldGJveC13ZWJob29rIiwibmJmIjoxNjQwODU2NTg2LCJtesttest_keysYsImF1ZCI6WyJrYWZrYS1yZXN0LXByb3h5Il0sImlzcyI6InNlY3JldC9kYXRhLXN0b3JhZ2Uva2Fma2EtcmVzdC1wcm94eS9kZXYvc2VydmljZS1hdXRoIn0.GAEcbzR5Hk7SKg2ZGcE37Ti85VzxxTJkqBzHv7abNjyWYZ2UfI9MZLG--GE2AYSP6ZxOGSylU69gfXiH-jlzrlXylgHt9ZfQzQPqTGXzyy3orinr3tpepKvkKTA_uPRK1vAoyux3Uit0Z617_QCatnvpSDcm5EKCbIa8StvxcLRu6D_zK8uzTBHyIDnnwVwvBDGc6Cd40Cfg7JGTest_keys_testEDG5YTR5xBknSiEXnmXEKWtGnLmyFOoKjifmy1ui78pc4testkeystestV9psBdKGLKEkzmmDsTL6SxMBgNY_nKCAWbZl4SQ

Not sure why the error happend. The netbox version: v3.1.5

jinsiang2008 avatar Jul 12 '22 11:07 jinsiang2008

How exactly is this related to pynetbox package?

markkuleinio avatar Jul 30 '22 17:07 markkuleinio

It doesn't appear to be. Also, your NetBox installation is a bit dated; please try upgrading to the current stable release and you may find that it resolves your issue.

jeremystretch avatar Aug 01 '22 12:08 jeremystretch

Closing this issue as it appears to be a configuration error.

arthanson avatar Oct 14 '22 20:10 arthanson