Skip to content

Common Issues

Jeremy Stretch edited this page Jun 14, 2021 · 4 revisions

ProgrammingError Exception Following a Recent Upgrade

What's Happening

Django (the Python framework on which NetBox runs) is attempt to access or modify a database field which doesn't exist. The full exception class is django.db.utils.ProgrammingError.

Recommended Solution

This is most commonly happens when new code is being run without first applying the necessary database migrations. Migrations are normally handled by the included upgrade script, but you can try applying them manually with the command python3 manage.py migrate. If this command indicates that new migrations have been applied successfully, try accessing NetBox again.

502 Bad Gateway Error When Calling NAPALM API

What's Happening

NetBox is using NAPALM to request information from a device, but the WSGI process is timing out before the device responds.

Recommended Solution

You can increase the timeout of the WSGI process so that it waits longer for the device to respond. For example, you can set timeout=60 in your Gunicorn configuration file. (Gunicorn's default timeout is 30 seconds.) Keep in mind that there's also a timeout value controlled by your HTTP daemon (e.g. nginx or Apache), which determines how long it will wait for a response from the WSGI service. This timeout must be equal to or greater than the WSGI timeout.

Rack Elevations Do Not Display (v2.7+)

What's Happening

NetBox makes two requests to its REST API to render the front and rear elevations of a rack. You can try fetching these SVG images directly by requesting /api/dcim/racks/XXX/elevation/?render=svg, where XXX is the rack's database ID.

If the direct API call is successful but the images don't appear on the rack page, it's likely that your HTTP server is setting the X-Frame-Options header to DENY. You can inspect the headers of the response by opening your browser's developer tools (F12 in Firefox/Chrome) and inspecting the initial request for the rack page. X-Frame-Options should be set to SAMEORIGIN.

Recommended Solution

Inspect the configuration of your HTTP daemon (e.g. nginx or Apache) and remove any statements which statically set the X-Frame-Options header.

Rack Elevation Links use Wrong Domain

What's Happening

NetBox runs as a WSGI application behind front-end HTTP server (e.g. Apache or nginx), which serves as a reverse proxy. Because NetBox doesn't have direct access to the raw HTTP request, it relies on the HTTP server to forward important details, such as the requested host and the HTTP protocol in use. If these details are not correctly forwarded to NetBox, NetBox will be unable to render absolute URLs (those which start with https://, as opposed to a relative URL).

For most hyperlinks, NetBox uses relative links. However, in a few specific instances, such as when rendering rack elevations, NetBox must use absolute URLs. This is because the rack elevations are actually embedded SVG images: Since these images might also appear outside the NetBox UI, absolute URLs must be used. If the HTTP frontend has not been configured to correctly relay the necessary information about the incoming HTTP request, these links will use the IP address of the backend service rather than the requested host or IP address.

Recommended Solution

This is a simple fix. Just ensure that your HTTP server is sending the X-Forwarded-Proto and X-Forwarded-Host HTTP headers on requests being proxied via WSGI. Example configurations for both nginx and Apache are included for your reference.