Skip to content

Truncate oversized log messages before sending to server - #925

Merged
aldo-expensify merged 4 commits into
Expensify:mainfrom
dukenv0307:fix/655280
Jul 6, 2026
Merged

aldo-expensify merged 4 commits into
Expensify:mainfrom
dukenv0307:fix/655280

Conversation

@dukenv0307

@dukenv0307 dukenv0307 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/655280

Tests

  1. In https://github.com/Expensify/App/blob/main/src/libs/Log.ts, add
if (typeof window !== 'undefined') {
    (window as unknown as {TestLog: typeof Log}).TestLog = Log;
}
  1. In https://github.com/Expensify/Web-Expensify/blob/77dce47f0cdae88d1c9bfcd57987c241883a07bb/lib/LogAPI.php#L54, add
if (preg_match('/\[truncated \d+ characters\]$/', $log['message'])) {
                    self::info('Received truncated client log message', ['length' => strlen($log['message'])]);
                }
  1. Run App, open the browser console, and run
window.TestLog.info('X'.repeat(2 * 1024 * 1024), true);
  1. Verify Received truncated client log message is shown in the log
Screenshot 2026-07-03 at 6 57 49 PM

QA

N/A

@dukenv0307
dukenv0307 marked this pull request as ready for review July 3, 2026 12:03
@dukenv0307
dukenv0307 requested a review from a team as a code owner July 3, 2026 12:03
@melvin-bot
melvin-bot Bot requested review from aldo-expensify and removed request for a team July 3, 2026 12:04
@dukenv0307

Copy link
Copy Markdown
Contributor Author

@robertjchen could you please review this PR?

@robertjchen robertjchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aldo-expensify
aldo-expensify merged commit 6f31d3c into Expensify:main Jul 6, 2026
8 checks passed
@os-botify

os-botify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Published to npm in 2.0.190 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants