Develop locally with fcdev fn dev
fcdev fn dev is the inner loop for a function project in TypeScript, Go or Rust. It needs no
platform, no database and no sign-in.
fcdev fn dev [dir] [--send sample.xml] [--path /events/trip] [--secret K=V] [--config K=V]It builds the project exactly as fcdev fn build does, serves the artifact on the real function
runner at 127.0.0.1:8099, then watches the source tree. Every change rebuilds and hot-reloads, and a
successful reload prints one line:
ok v3 js in 840ms size=212KB digest=9f2c41ab07de routes=2 subscriptions=1 schedules=0 dispatches=2A failed build prints the toolchain’s error and the loop carries on: the previous good build keeps serving until a build succeeds.
A good workflow
Section titled “A good workflow”- Write unit tests while writing handlers (
npm test,go test,cargo test). They run against the SDK’s fake host in milliseconds. See Write a function. - In a second terminal run
fcdev fn dev --send sample.xml --path /events/trip --secret API_KEY=..., then edit, save and read the response. The sample file is re-read on every send, so editing it resends without a rebuild. - On a terminal,
r+ Enter resends the last request andq+ Enter quits. fcdev fn deployto a non-production platform before production (Publish, promote and use aliases).
Request replay
Section titled “Request replay”--send FILE sends the file after every successful (re)load.
| Flag | Default | Meaning |
|---|---|---|
--method |
POST |
HTTP method |
--path |
/ |
request path |
--header 'K: V' |
none | repeatable |
--content-type |
by extension | .xml is application/xml, .json is application/json, anything else application/octet-stream |
--webhook-secret |
dev-webhook-secret |
the signing secret webhook endpoints verify |
Auth is added from the endpoint the path lands on: a webhook endpoint is signed with
--webhook-secret, and a platform endpoint gets a dev bearer token (any token is accepted locally;
--perms sets the permissions of the dev principal). The output shows the status, selected headers,
the body (JSON pretty-printed, truncated at 8 KiB with a note) and, grouped under the request, the
events the call emitted and the jobs it would create. Without --send, fn dev prints a curl line
per endpoint instead.
Dispatches
Section titled “Dispatches”A function’s dispatch call is checked against the version’s declared dispatches with the real
route’s shape rules: declared target and path, valid JSON for JSON content types, metadata limits. A
match prints what would happen and returns a fake job id:
would create job: target=yard.logger path=/deliver pool=yard-process-pool connection=yard-conn group=trip-42 payload={"id":42}A refusal returns the ABI error to the function and prints dispatch refused: CODE: message. An
undeclared target is refused by the runner itself as NOT_DECLARED, exactly as on a platform. See
Create a dispatch job from a function.
| Flag | Meaning |
|---|---|
--address |
the function’s address (default local.<directory name>) |
--port |
listen port (default 8099) |
--config K=V, --secret K=V |
settings; secret values are masked in everything fn dev prints |
--db NAME=DSN |
a database binding |
--perms |
permissions of the dev principal |
--memory |
memory limit in MB |
--runtime wasm|js |
override the runtime picked from the artifact |
--no-watch |
build and serve once |
fcdev fn run <artifact> --config GREETING=Hi --watch serves an already-built artifact the same way,
for when you want the runner without the build step.
What a local run cannot tell you
Section titled “What a local run cannot tell you”- No platform. Events are not ingested and jobs are not created; they are printed.
- Pools, connections and target functions are not resolved. Their existence and status, application ownership and the target’s webhook endpoint are checked only on a real platform.
- No connection signing. Deliveries are not signed by a connection’s service account (on a platform
a function’s verifier account is set with
fcdev fn set <address> --service-account <code>). - Subscriptions and schedules are not fired. Call their paths with
--send. - Loopback only. It listens on
127.0.0.1. Watching is by polling (300 ms, modification time and size) and ignoresnode_modules,dist,target,bin,vendor,.git, hidden paths and build outputs. - JVM functions do not run here. A
.jaris ajvmfunction: deploy it to a localfcdev, where the ingestor serves it (see Ingestion under fcdev).
For what the platform checks that a local run cannot, deploy to a non-production platform and test there.