Skip to content

fix: Complete Frenet tracking runs, SSR fetch cache under concurrency and tokens out of logs - #863

Merged
leomp12 merged 4 commits into
mainfrom
fix/tracking-ssr-fetch-log-tokens
Oct 26, 2026
Merged

leomp12 merged 4 commits into
mainfrom
fix/tracking-ssr-fetch-log-tokens

Conversation

@leomp12

@leomp12 leomp12 commented Oct 25, 2026

Copy link
Copy Markdown
Member

Summary

Fixes found while checking the stores' function logs:

  • Frenet tracking: the cron resolved after the first code (codes.forEach(async ...) + resolve per code), so the remaining tracking updates could be cut when the function finished. Now it waits for all codes (Promise.allSettled, still in parallel).
  • Tracking crons without the app: Frenet, Flash Courier and Melhor Envio read app[0] without checking it, logging an error every run on stores where the app isn't installed. Now they just skip.
  • SSR fetchAndCache: concurrent renders shared the same Response, so all but the first failed with "Body has already been read". A failed or timed out fetch also stayed in runtimeFetchings forever, failing every next call for that key until the instance restarted. Now concurrent calls share the parsed data and the entry is cleared on settle. Callers (store sections) already catch errors, the throw contract is unchanged.
  • Tokens in logs: the shared logger (@cloudcommerce/firebase/lib/config) now masks credential headers (Authorization, Access-Token, API keys, cookie) from Axios errors and request configs in log data, without mutating the original error. Covers the TikTok Access-Token in send-analytics-events and the store custom integrations that log error.config. Melhor Envio error handling now uses the shared logger and drops headers from its stringified configs.

Test plan

  • Lint and build (tsc) of firebase, ssr, frenet, melhor-envio, flash-courier
  • Logged a real Axios 401 with Authorization/Access-Token through logger.error(err), logger.warn(err, { request: { headers } }) and logger.error(err, { request: err.config }): all masked, stack kept, original error untouched

🤖 Generated with Claude Code

https://claude.ai/code/session_01AzZmcNMuAAjtyPLYYbnJBX

leomp12 and others added 4 commits October 25, 2026 13:36
…thout the app

Frenet finished the run after the first code, so the remaining tracking updates
could be cut; now it waits for all codes. Frenet, Flash Courier and Melhor Envio
tracking crons no longer log an error each run when the app isn't installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzZmcNMuAAjtyPLYYbnJBX
…s and after timeouts

Concurrent renders shared one response body, which can be read only once, so
all but the first failed. A timed out or failed fetch also stayed cached until
the instance restarted. Now the parsed data is shared and failures are cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzZmcNMuAAjtyPLYYbnJBX
The shared logger masks credential headers (Authorization, Access-Token, API
keys) from Axios errors and request configs, which covers TikTok events and
store custom integrations. Melhor Envio error logs no longer include headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzZmcNMuAAjtyPLYYbnJBX
…all on masking

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzZmcNMuAAjtyPLYYbnJBX
@leomp12
leomp12 merged commit 51bb4ef into main Oct 26, 2026
2 checks passed
@leomp12
leomp12 deleted the fix/tracking-ssr-fetch-log-tokens branch October 26, 2026 23:15
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.

1 participant