Skip to content

core: RPC calls over 6 MB or about 28 s succeed locally, fail on AWS (the dev server has no payload or duration limit) #1268

Open

Description

@belaboe

Before opening, please confirm

  • I have searched for duplicate or closed issues.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Which package(s) are affected?

Core

Describe the bug

Every ApiNamespace method runs behind API Gateway and Lambda once deployed, so it inherits their limits. The local dev server enforces none of them except a 10 MiB request cap:

Call Local Deployed
a method that takes 28 s or more ok (no failure up to 40 s) 504 HandlerTimeoutError from 28 s
a method whose result is over 6 MB ok (no failure up to 8 MiB) 502 from API Gateway
a request body between 6 MB and 10 MiB ok 413 from API Gateway
a request body over 10 MiB 413 PayloadTooLarge 413 from API Gateway

The Lambda handler already races the handler against a deadline just under API Gateway's 29 s (HandlerTimeoutError, 504), but the dev server has no equivalent, so a slow report, export or model call that works in npm run dev times out in production. The same goes for large results: the 6 MB Lambda response limit only shows up after deploy (and, because of the client bug filed alongside this one, shows up as undefined rather than an error).

Expected behavior

The dev server applies the deployed limits to RPC calls: the same handler deadline (returning the same 504 HandlerTimeoutError envelope), a 6 MB request and response limit (or a clear warning when a response exceeds it), so the failure appears during development.

Reproduction steps

export const api = new ApiNamespace(scope, 'api', () => ({
  async slow() { await new Promise((r) => setTimeout(r, 30_000)); return 'done'; },
  async big() { return 'a'.repeat(7 * 1024 * 1024); },
  async upload(body: string) { return body.length; },
}));
  1. npm run dev: api.slow() returns 'done', api.big() returns the string, api.upload('a'.repeat(7 * 1024 * 1024)) returns the length.
  2. Deploy and repeat: slow() fails with 504 HandlerTimeoutError, big() gets a 502, upload() gets a 413.

Environment

  • @aws-blocks/* 0.8.0 (main at 34e758c)
  • Local: npm run dev dev server, Node 22, macOS
  • Deployed: a sandbox stack in us-east-1

Additional context

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-maintainer-responseWaiting on a response from the maintainerspending-triageIssue is pending triage by the maintainers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions