deco-server-functions-invoke
Installation
SKILL.md
Sub-documents
| Document | Topic |
|---|---|
| problem.md | The CORS problem — root cause analysis of why createServerFn inside a factory function doesn't work |
| architecture.md | Three-layer invoke architecture and comparison with deco-cx/deco |
| generator.md | The generate-invoke.ts script — how it works, how to run it, how to extend |
| troubleshooting.md | Common issues and how to debug them |
Deco Server Functions & Invoke
How server-side actions (cart, checkout, newsletter, masterdata) are called from the browser in Deco TanStack Start storefronts.
The Problem in One Sentence
TanStack Start's createServerFn compiler only transforms .handler() calls at module top-level — wrapping it in a factory function (createInvokeFn) causes the compiler's "fast path" to skip it, sending raw VTEX API calls to the browser and causing CORS errors.