Skip to content

Durable stream fetch(url) returns empty body despite successful write #1236

@parteeksingh24

Description

@parteeksingh24

stream.write() + stream.close() succeed without error. agentuity cloud stream list reports the correct size. But fetch(stream.url) from the deployed runtime returns HTTP 200 with 0 bytes.

Issue

const stream = await c.var.stream.create('devrel-audit-reports', {
  contentType: 'text/markdown; charset=utf-8',
  ttl: null,
  metadata: { entitySlug: 'xai', runId: '...' },
});
await stream.write(reportText);  // 26+ KB
await stream.close();

const resp = await fetch(stream.url);
// resp.status = 200, resp.ok = true
const body = await resp.text();
// body.length = 0

CLI confirms the data is stored:

$ agentuity cloud stream list --namespace devrel-audit-reports
ID:    stream_019d044d60d0748588b7929c3f54076e
Size:  26.70 KB

Tested across 3 streams over multiple deployments (March 17-19). Consistent behavior — not intermittent. One preflight test with a small payload (~100 bytes) did succeed, so it may be size or timing dependent.

Stream URLs are documented as public and shareable, but from external networks the hostnames (streams-*.agentuity.cloud) resolve to private IPs, preventing any external access.

Environment: Agentuity Cloud (usw), @agentuity/runtime latest

Potential Cause

Likely a consistency gap between stream.close() returning and the content being readable. close() may signal completion in the metadata cache before chunk data is fully visible to the read path. A fetch hitting a different cache node or racing the database write would see the stream as complete but with no chunks to serve.

Workaround

KV as primary read path, stream creation as non-fatal secondary:

await c.var.kv.set(namespace, key, reportText, { ttl: null });
try {
  const stream = await c.var.stream.create(ns, { ... });
  await stream.write(reportText);
  await stream.close();
} catch { /* non-fatal */ }

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions