Fix null assignee handling in Seat model to prevent 500 Internal Server Error #217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Users were encountering a 500 Internal Server Error when accessing the
/api/seats
endpoint:This occurred when the GitHub Copilot billing seats API returned entries where the
assignee
field isnull
. This happens when a user has been removed from the organization but their seat assignment still exists in the system as a deprecated entry.Root Cause
The
Seat
model constructor was attempting to accessdata.assignee.login
anddata.assignee.id
without null checks:When
data.assignee
wasnull
, this resulted inTypeError: Cannot read properties of null (reading 'login')
, causing the 500 server error.Solution
Added null safety checks with appropriate fallback values:
Changes Made
data.assignee
with sensible fallback valuesTesting
The fix ensures that deprecated seats (with null assignees) are displayed with
login: 'deprecated'
andid: 0
instead of causing server crashes.Fixes #209.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.fontshare.com
node (vitest)
(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build
(dns block)api.fontsource.org
node (vitest)
(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build
(dns block)fonts.bunny.net
node (vitest)
(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build
(dns block)fonts.google.com
node (vitest)
(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build
(dns block)fonts.googleapis.com
node (vitest 1)
(dns block)node (vitest 2)
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.