awslabs / awslabs/agentcore-samples
06-workshops - [Bug] 07-Temporal Policies: API calls return 404 after static build — absolute paths bypass proxy
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
**In which component is this bug present?**
- [ ] 01-AgentCore-runtime
- [x] 02-AgentCore-gateway
- [ ] 03-AgentCore-identity
- [ ] 04-AgentCore-memory
- [ ] 05-AgentCore-tools
- [ ] 06-AgentCore-observability
- [ ] 07-AgentCore-E2E
**Bug Description**
UI loads but shows "HTTP 404 (dismiss)" error.
Cause: The frontend API client uses absolute paths (`/api/config`, `/api/sessions/...`). Browser at `/app/5173/` resolves these as `https://domain/api/config` — without the `/app/5173/` prefix, nginx doesn't proxy them to the static server (which proxies to the Express backend).
**Suggested Fix**
Fix API client to use relative paths in `web/src/api/client.ts`:
```typescript
const BASE = import.meta.env.BASE_URL; // resolves to "./" at build time
async function request(url: string, init?: RequestInit): Promise {
const res = await fetch(BASE + url.replace(/^\//, ""), { ... });
}
```
Contributor guide
Assessment
This issue has not been assessed yet.