[GH-ISSUE #5139] last_seen field on /api/peers returning wrong value #9980

Open
opened 2026-08-05 01:24:12 -04:00 by saavagebueno · 2 comments
Owner

Originally created by @zerowhybr on GitHub (Jan 20, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5139

Describe the problem

I am using the HTTP API for some automations and one of the fields I use is the last_seen value. However, after an upgrade from version v0.60.7 to v0.62.3, I noticed the way the value of last_seen is calculated has changed. When a peer was connected, before the upgrade it returned a value close to the current time. After the upgrade, the last_seen value now represents when the peer last started the connection, even with the peer online.

After observing this, I tested out the API on a fresh instance of NetBird with the latest version (v0.63.0 at the time of this issue's creation) and the problem persists.

If you guys need any more info, just let me know.

To Reproduce

Steps to reproduce the behavior:

  1. Fresh install of NetBird v0.63.0
  2. Have some peers online/offline for testing
  3. Request the peer list through HTTP GET /api/peers
  4. See incorrect last_seen data for connected peers

Expected behavior

It is expected for last_seen to be equal (or close enough) to current time when the peer has connected=true

Are you using NetBird Cloud?

I am using a self-hosted deployment. I used the quickstart installation script.

NetBird version

netbird version: 0.63.0

Is any other VPN software installed?

If yes, which one?

No.

Debug output

To help us resolve the problem, please attach the following anonymized status output

Not applicable, problem in the API

Create and upload a debug bundle, and share the returned file key:

netbird debug for 1m -AS -U

Uploaded files are automatically deleted after 30 days.

Alternatively, create the file only and attach it here manually:

netbird debug for 1m -AS

Not applicable, problem in the API

Additional context

This is an example output response from the API. "device3" was recently booted, and the last_seen value is set to the time it connected to NetBird.

# API call
curl -X GET https://vpn.domain.com/api/peers \
      -H 'Accept: application/json' \
      -H "Authorization: Token $TOKEN" | jq '.[] | .hostname + " connected=" + (.connected|tostring) + " last_seen=" + .last_seen'

"device1 connected=true last_seen=2026-01-20T02:48:50.997060507Z"
"device2 connected=false last_seen=2026-01-18T04:41:56.6709345Z"
"device3 connected=true last_seen=2026-01-20T13:03:12.832987248Z"

# Current date
date --utc +%FT%TZ   
2026-01-20T13:13:18Z

Have you tried these troubleshooting steps?

  • [ N/A ] Reviewed client troubleshooting (if applicable)
  • [ X ] Checked for newer NetBird versions
  • [ X ] Searched for similar issues on GitHub (including closed ones)
  • [ N/A] Restarted the NetBird client
  • [ N/A ] Disabled other VPN software
  • [ N/A ] Checked firewall settings
Originally created by @zerowhybr on GitHub (Jan 20, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5139 **Describe the problem** I am using the HTTP API for some automations and one of the fields I use is the last_seen value. However, after an upgrade from version v0.60.7 to v0.62.3, I noticed the way the value of last_seen is calculated has changed. When a peer was connected, before the upgrade it returned a value close to the current time. After the upgrade, the last_seen value now represents when the peer last started the connection, even with the peer online. After observing this, I tested out the API on a fresh instance of NetBird with the latest version (v0.63.0 at the time of this issue's creation) and the problem persists. If you guys need any more info, just let me know. **To Reproduce** Steps to reproduce the behavior: 1. Fresh install of NetBird v0.63.0 2. Have some peers online/offline for testing 3. Request the peer list through HTTP GET /api/peers 4. See incorrect last_seen data for connected peers **Expected behavior** It is expected for last_seen to be equal (or close enough) to current time when the peer has connected=true **Are you using NetBird Cloud?** I am using a self-hosted deployment. I used the quickstart installation script. **NetBird version** `netbird version`: 0.63.0 **Is any other VPN software installed?** If yes, which one? No. **Debug output** To help us resolve the problem, please attach the following anonymized status output Not applicable, problem in the API Create and upload a debug bundle, and share the returned file key: netbird debug for 1m -AS -U *Uploaded files are automatically deleted after 30 days.* Alternatively, create the file only and attach it here manually: netbird debug for 1m -AS Not applicable, problem in the API **Additional context** This is an example output response from the API. "device3" was recently booted, and the last_seen value is set to the time it connected to NetBird. ```sh # API call curl -X GET https://vpn.domain.com/api/peers \ -H 'Accept: application/json' \ -H "Authorization: Token $TOKEN" | jq '.[] | .hostname + " connected=" + (.connected|tostring) + " last_seen=" + .last_seen' "device1 connected=true last_seen=2026-01-20T02:48:50.997060507Z" "device2 connected=false last_seen=2026-01-18T04:41:56.6709345Z" "device3 connected=true last_seen=2026-01-20T13:03:12.832987248Z" # Current date date --utc +%FT%TZ 2026-01-20T13:13:18Z ``` **Have you tried these troubleshooting steps?** - [ N/A ] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [ X ] Checked for newer NetBird versions - [ X ] Searched for similar issues on GitHub (including closed ones) - [ N/A] Restarted the NetBird client - [ N/A ] Disabled other VPN software - [ N/A ] Checked firewall settings
saavagebueno added the triage-needed label 2026-08-05 01:24:12 -04:00
Author
Owner

@mmelendezvega commented on GitHub (Feb 16, 2026):

Hello, I am having the same problem.
Did you find a solution?

<!-- gh-comment-id:3911140731 --> @mmelendezvega commented on GitHub (Feb 16, 2026): Hello, I am having the same problem. Did you find a solution?
Author
Owner

@alistarle commented on GitHub (Jul 9, 2026):

We actually see the same bug on our side

<!-- gh-comment-id:4925404855 --> @alistarle commented on GitHub (Jul 9, 2026): We actually see the same bug on our side
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#9980