Skip to content

Commit

Permalink
Fix 500 error when requesting a user-access-token
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Dec 6, 2024
1 parent 9d5ffbd commit c6cbf1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.27.1 (????-??-??)
-------------------

* Fix HTTP/500 error when requesting a developer access token.


0.27.0 (2024-12-05)
-------------------

Expand Down
9 changes: 8 additions & 1 deletion src/log/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import geoip from 'geoip-lite';
import { UserLogRecord } from 'knex/types/tables.js';

export function getLoggerFromContext(ctx: Context, principal?: Principal|number): UserEventLogger {

let principalId;
if (typeof principal === 'number') {
principalId = principal;
} else {
principalId = principal?.id ?? ctx.session.user?.id;
}
return (et: EventType) => addLogEntry(
et,
ctx.ip() ?? '',
principal ?? ctx.session.user?.id,
principalId,
ctx.request.headers.get('User-Agent')
);
}
Expand Down

0 comments on commit c6cbf1f

Please sign in to comment.