Livesearch API Results JS error #812

Closed
opened 2025-12-29 16:26:01 +01:00 by adam · 1 comment
Owner

Originally created by @benagricola on GitHub (Mar 29, 2017).

Issue type: Bug

Python version: 2.7.5
NetBox version: v2.0-beta1

livesearch.js currently runs an API call against the specified API endpoint, then iterates over the top-level JSON object returned. It looks like the V2 API (at least for device-list and ipaddress-list, haven't checked the others) returns the results inside a results property of the top-level object.

This manifests as a JS error in the browser similar to the following in Chrome:

livesearch.js:32 Uncaught TypeError: Cannot read property 'id' of null
    at livesearch.js:32
    at Function.each (jquery-2.1.4.min.js:2)
    at Object.success (livesearch.js:30)
    at j (jquery-2.1.4.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-2.1.4.min.js:2)
    at x (jquery-2.1.4.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-2.1.4.min.js:4)

Commit afd187ada6817b4396f8980daa5f95e110af1f3b resolves this - happy to submit a PR if this is deemed the correct fix.

Originally created by @benagricola on GitHub (Mar 29, 2017). ### Issue type: Bug **Python version: 2.7.5** **NetBox version: v2.0-beta1** `livesearch.js` currently runs an API call against the specified API endpoint, then iterates over the top-level JSON object returned. It looks like the V2 API (at least for `device-list` and `ipaddress-list`, haven't checked the others) returns the results inside a `results` property of the top-level object. This manifests as a JS error in the browser similar to the following in Chrome: ``` livesearch.js:32 Uncaught TypeError: Cannot read property 'id' of null at livesearch.js:32 at Function.each (jquery-2.1.4.min.js:2) at Object.success (livesearch.js:30) at j (jquery-2.1.4.min.js:2) at Object.fireWith [as resolveWith] (jquery-2.1.4.min.js:2) at x (jquery-2.1.4.min.js:4) at XMLHttpRequest.<anonymous> (jquery-2.1.4.min.js:4) ``` Commit afd187ada6817b4396f8980daa5f95e110af1f3b resolves this - happy to submit a PR if this is deemed the correct fix.
adam closed this issue 2025-12-29 16:26:01 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 29, 2017):

Looks like this has already been fixed in v2-develop as part of #997.

@jeremystretch commented on GitHub (Mar 29, 2017): Looks like this has already been fixed in `v2-develop` as part of #997.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#812