Skip to content

Update from 4.5.1-3.4.2 to 4.5.2-4.0.0 does not enable API v2 tokens #1617

@exu-g

Description

@exu-g

Current Behavior

Updating from 4.5.1-3.4.2 to 4.5.2-4.0.0 and implementing all breaking changes for the update does not enable v2 tokens.

Netbox Container

Inspect shows the env variables set. I tried using my own secrets generated using openssl rand -hex 32 and also tried the default value set in netbox.env
netbox-worker also has both env variables set to the same values

[
  {
        "Image": "sha256:50361ab5d64a62bce71ab46ef6993e1a47c9d19aafe82f837e8533444f48531e",
        "Config": {
            "User": "netbox:root",
            "Env": [
                "API_TOKEN_PEPPER_1=Qy+F=OTeGskWQ(wTMgjc+NPPlz6YwFXY=KHIIg=wpYXT&e(6u8",
                "API_TOKEN_PEPPERS=Qy+F=OTeGskWQ(wTMgjc+NPPlz6YwFXY=KHIIg=wpYXT&e(6u8",
            ],
            "Image": "netbox:latest-plugins",
        }
    }
]

Dockerfile for the custom container

FROM docker.io/netboxcommunity/netbox:v4.5

COPY ./plugin_requirements.txt /opt/netbox/

RUN /usr/local/bin/uv pip install -r /opt/netbox/plugin_requirements.txt

# This SECRET_KEY is only used during the installation. There's no need to change it.
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-inputroot@inf-nbx02:/etc/docker/

Trying to add a v2 token in the webinterface gives me this error

Image

Expected Behavior

Defining API_TOKEN_PEPPER_1 (or maybe API_TOKEN_PEPPERS ?) as env variable should allow using v2 tokens

Docker Compose Version

Docker Compose version v2.39.4

Docker Version

Client: Docker Engine - Community
 Version:           28.4.0
 API version:       1.51
 Go version:        go1.24.7
 Git commit:        d8eb465
 Built:             Wed Sep  3 20:57:37 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.4.0
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.7
  Git commit:       249d679
  Built:            Wed Sep  3 20:57:37 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

The git Revision

N/A - I use a custom Ansible deployment

The git Status

N/A - I use a custom Ansible deployment

Startup Command

docker compose -p staging up

NetBox Logs

⚙ Applying database migrations
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
Operations to perform:
  Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, netbox_data_flows, netbox_dns, sessions, social_django, taggit, tenancy, thumbnail, users, virtualization, vpn, wireless
Running migrations:
  Applying core.0021_job_queue_name... OK
⚙ Running trace_paths
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
Found no missing console port paths; skipping
Found no missing console server port paths; skipping
Found no missing interface paths; skipping
Found no missing power feed paths; skipping
Found no missing power outlet paths; skipping
Found no missing power port paths; skipping
Finished.
⚙ Removing stale content types
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
⚙ Removing expired user sessions
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
⚙ Building search index (lazy)
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
Reindexing 105 models.
Indexing models
  netbox_dns.record... No objects found.
  netbox_dns.view... Skipping (found 2 existing).
  netbox_dns.nameserver... No objects found.
  netbox_dns.zone... No objects found.
  netbox_dns.registrationcontact... No objects found.
  netbox_dns.registrar... No objects found.
  netbox_dns.zonetemplate... No objects found.
  netbox_dns.recordtemplate... No objects found.
  netbox_dns.dnsseckeytemplate... No objects found.
  netbox_dns.dnssecpolicy... No objects found.
  core.datasource... No objects found.
  core.datafile... No objects found.
  circuits.circuit... No objects found.
  circuits.circuitgroup... No objects found.
  circuits.circuittermination... No objects found.
  circuits.circuittype... No objects found.
  circuits.provider... No objects found.
  circuits.provideraccount... No objects found.
  circuits.providernetwork... No objects found.
  circuits.virtualcircuit... No objects found.
  circuits.virtualcircuittermination... No objects found.
  circuits.virtualcircuittype... No objects found.
  dcim.cable... No objects found.
  dcim.consoleport... No objects found.
  dcim.consoleserverport... No objects found.
  dcim.device... No objects found.
  dcim.devicebay... No objects found.
  dcim.devicerole... No objects found.
  dcim.devicetype... No objects found.
  dcim.frontport... No objects found.
  dcim.macaddress... No objects found.
  dcim.interface... No objects found.
  dcim.inventoryitem... No objects found.
  dcim.inventoryitemrole... No objects found.
  dcim.location... No objects found.
  dcim.manufacturer... No objects found.
  dcim.module... No objects found.
  dcim.modulebay... No objects found.
  dcim.moduletypeprofile... Skipping (found 7 existing).
  dcim.moduletype... No objects found.
  dcim.platform... No objects found.
  dcim.powerfeed... No objects found.
  dcim.poweroutlet... No objects found.
  dcim.powerpanel... No objects found.
  dcim.powerport... No objects found.
  dcim.racktype... No objects found.
  dcim.rack... No objects found.
  dcim.rackreservation... No objects found.
  dcim.rackrole... No objects found.
  dcim.rearport... No objects found.
  dcim.region... No objects found.
  dcim.site... No objects found.
  dcim.sitegroup... No objects found.
  dcim.virtualchassis... No objects found.
  dcim.virtualdevicecontext... No objects found.
  ipam.aggregate... No objects found.
  ipam.asn... No objects found.
  ipam.asnrange... No objects found.
  ipam.fhrpgroup... No objects found.
  ipam.ipaddress... No objects found.
  ipam.iprange... No objects found.
  ipam.prefix... No objects found.
  ipam.rir... No objects found.
  ipam.role... No objects found.
  ipam.routetarget... No objects found.
  ipam.service... No objects found.
  ipam.servicetemplate... No objects found.
  ipam.vlan... No objects found.
  ipam.vlangroup... No objects found.
  ipam.vlantranslationpolicy... No objects found.
  ipam.vlantranslationrule... No objects found.
  ipam.vrf... No objects found.
  extras.configcontextprofile... No objects found.
  extras.customfield... No objects found.
  extras.imageattachment... No objects found.
  extras.journalentry... No objects found.
  extras.tag... No objects found.
  extras.webhook... No objects found.
  tenancy.contact... No objects found.
  tenancy.contactgroup... No objects found.
  tenancy.contactrole... No objects found.
  tenancy.tenant... Skipping (found 4 existing).
  tenancy.tenantgroup... No objects found.
  virtualization.cluster... Skipping (found 1 existing).
  virtualization.clustergroup... No objects found.
  virtualization.clustertype... Skipping (found 2 existing).
  virtualization.virtualmachine... Skipping (found 1 existing).
  virtualization.vminterface... No objects found.
  virtualization.virtualdisk... No objects found.
  vpn.tunnel... No objects found.
  vpn.tunnelgroup... No objects found.
  vpn.ikeproposal... No objects found.
  vpn.ikepolicy... No objects found.
  vpn.ipsecproposal... No objects found.
  vpn.ipsecpolicy... No objects found.
  vpn.ipsecprofile... No objects found.
  vpn.l2vpn... No objects found.
  wireless.wirelesslan... No objects found.
  wireless.wirelesslangroup... No objects found.
  wireless.wirelesslink... No objects found.
  netbox_data_flows.applicationrole... No objects found.
  netbox_data_flows.application... No objects found.
  netbox_data_flows.dataflow... No objects found.
  netbox_data_flows.dataflowgroup... No objects found.
  netbox_data_flows.objectalias... No objects found.
Completed. Total entries: 17
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
✅ Initialisation is done.
[WARNING] Configured number of workers appears to be higher than the amount of CPU cores available. Mind that such value might actually decrease the overall throughput of the server. Consider using 2 workers and tune threads configuration instead
[INFO] Starting granian (main PID: 6)
[INFO] Listening at: http://:::8080
[INFO] Spawning worker-1 with PID: 314
[INFO] Spawning worker-2 with PID: 316
[INFO] Spawning worker-3 with PID: 318
[INFO] Spawning worker-4 with PID: 320
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
/opt/netbox/netbox/netbox/settings.py:245: UserWarning: API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.
  warnings.warn("API_TOKEN_PEPPERS is not defined. v2 API tokens cannot be used.")
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
溺 loaded config '/etc/netbox/config/configuration.py'
溺 loaded config '/etc/netbox/config/extra.py'
溺 loaded config '/etc/netbox/config/keycloak.py'
溺 loaded config '/etc/netbox/config/logging.py'
溺 loaded config '/etc/netbox/config/plugins.py'
[INFO] Started worker-3
[INFO] Started worker-1
[INFO] Started worker-4
[INFO] Started worker-2
[2026-02-09 09:42:03 +0100] : - "GET /login/ HTTP/1.1" 200 3284.023
[2026-02-09 09:42:12 +0100] : - "GET /login/ HTTP/1.1" 200 5.016
[2026-02-09 09:42:27 +0100] : - "GET /login/ HTTP/1.1" 200 4.294

Content of docker-compose.override.yml

N/A - I use a custom Ansible deployment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions