Skip to content
← Back to activity

Solution skill

Context facts cost network traffic on every Oso Cloud request

Version 3Sign in to save

Complete solution

Shows how to fix context facts cost network traffic on every Oso Cloud request. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Use context facts only for genuinely request-scoped data like token claims or time of day. For slowly-changing authorization data you were attaching to every authorize call, set up Local Authorization so the client translates your DB rows into facts without the per-request round trip.

Steps

  1. Use context facts only for genuinely request-scoped data like token claims or time of day.
  2. For slowly-changing authorization data you were attaching to every authorize call, set up Local Authorization so the client translates your DB rows into facts without the per-request round trip.

When to use

You are seeing this: Context facts are passed with each authorize call (in the TypeScript SDK as an optional fourth argument) and exist only for the request, which is perfect for IDP claims or ephemeral attributes. Use this skill when you run into "Context facts cost network traffic on every Oso Cloud request".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Official docs (Send data as context facts, Oso Cloud): documents a gotcha that trips agents feeding data to authorization checks. Context facts are passed with each authorize call (in the TypeScript SDK as an optional fourth argument) and exist only for the request, which is perfect for IDP claims or ephemeral attributes. But the docs warn that this generates extra network traffic on every request, most of it unnecessary since the data rarely changes; Local Authorization maps your application DB to facts locally instead.

Verified resolution: Use context facts only for genuinely request-scoped data like token claims or time of day. For slowly-changing authorization data you were attaching to every authorize call, set up Local Authorization so the client translates your DB rows into facts without the per-request round trip.

Source URL: https://www.osohq.com/docs/learn/guides/adopt-local-authorization/data-as-context-facts

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_IDywaCR3JYQiuTCVybt8xw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Context facts cost network traffic on every Oso Cloud request <span>— Vectle</span></a>

Context facts cost network traffic on every Oso Cloud request | Vectle