netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.15k stars 2.58k forks source link

Dropdowns for all forms appear empty after upgrade #17867

Open ethnt opened 1 week ago

ethnt commented 1 week ago

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.3

Python Version

3.12

Steps to Reproduce

  1. Beginning on v3.7.8, add data (device roles, for example)
  2. Upgrade to v4.1.3
  3. Attempt to create a device using the previously created device role

Expected Behavior

The dropdowns should be populated with the corresponding data.

Observed Behavior

Dropdowns are empty, despite having data available.

CleanShot 2024-10-27 at 00 03 08@2x CleanShot 2024-10-27 at 00 03 45@2x

arthanson commented 1 week ago

@ethnt I think there is something else going wrong here, I just did a test upgrade from v3.7 to v4.1.5 and it works fine (see screenshot). The drop-downs get their data from the REST API so it might possibly be something wrong with that - maybe go to the REST API explorer (link at the bottom of the NetBox UI - the small icons - see second screenshot).

It might be better to close this issue and open it up as a discussion as it will be to the larger community and they might have more suggestions.

Add a new device | NetBox 2024-10-29 11-28-08 Devices | NetBox 2024-10-29 11-30-45

99-lives commented 2 days ago

Hello,

I'm experiencing the same issue here, but on a completely fresh Netbox docker install.

I've created a single Site, but when I go to create a Rack, I cannot select my Site from the dropdown. The same is for Site to Tennant, or Site to Region. No dropdowns that relate to other objects are populating. However, when I use the object selector when creating a Rack, it is able to find my Site. But when I select the Site, nothing happens on the web form, and a Javascript error is logged to the console. That error is:

netbox.js?v=4.1.6:20  Uncaught TypeError: Cannot read properties of undefined (reading 'setData')
    at _q (netbox.js?v=4.1.6:20:37103)
    at HTMLAnchorElement.<anonymous> (netbox.js?v=4.1.6:20:37267)
_q @ netbox.js?v=4.1.6:20
(anonymous) @ netbox.js?v=4.1.6:20

If there's anything more I can do to provide debug information, please let me know.

Cheers.

99-lives commented 2 hours ago

Update. Looking at the demo site, I can see that Netbox is making an API call when selecting a dropdown that relates to other objects. It doesn't prepopulate the dropdown on page load.

This API call does not happen on my deployment. Netbox never attempts any API calls to populate the dropdowns. This makes me think it's a Javascript issue somewhere.

99-lives commented 2 hours ago

Just fixed it by regenerating static files. It seems that that process wasn't completing properly. Probably worth investigating further, but now that I'm working, I'm happy.