rayfin functions
Command reference for scaffolding, running, and deploying Rayfin Functions projects with functions init and related dev/up commands.
rayfin functions manages the TypeScript Functions package for a Rayfin project. In 1.36 it is a top-level GA command group; no RAYFIN_FEATURE_FLAGS=functions value is required.
Note
Functions are not available in every Fabric region or tenant.
rayfin functions init
npx rayfin functions init [directory] [--force] [--path <relative-path>]Scaffolds a Functions package, enables the service, installs dependencies, builds, generates types, and installs Rayfin agent files.
| Argument or option | Default | Description |
|---|---|---|
[directory] | . | Project root directory. Run from a directory that already contains rayfin/. |
--force | false | Overwrite an existing functions scaffold. Without it, existing function code is preserved and the command refreshes dependencies, build output, and generated types. |
--path <relative-path> | Auto-detected | Location for the functions package, relative to the project root. Overrides rayfin.yml and workspace detection, and is saved to services.functions.path. New in 1.36 |
Path selection order:
--path <relative-path>.- Existing
services.functions.pathinrayfin.yml. - An npm workspace package when one is detected.
rayfin/functions/.
Fresh or forced scaffolds create or overwrite these files under the resolved functions path:
package.jsonwith build and watch scripts.tsconfig.jsonwith a project reference torayfin/.host.jsonfor the local Azure Functions Core Tools host.local.settings.jsonfor local-only runtime settings.src/function_app.ts,src/types.ts, andsrc/secrets.generated.ts..vscode/settings.jsonand.vscode/launch.jsonwith Functions: Attach..gitignoreentries for local settings and build output.
Scaffolding installs dependencies from npm, so functions init requires network access.
Fresh or forced scaffolds write:
services:
functions:
enabled: true
path: rayfin/functions
auth:
type: application
buildCommand: npm run buildOn every run, fresh scaffold or not, the command installs dependencies, builds, and regenerates src/types.ts. Use it to refresh generated types without overwriting source; pass --force only when you want the template files replaced.
The scaffold pins @microsoft/fabric-user-data-functions to the exact version of the running CLI. Re-running without --force preserves the existing package version.
Fresh Rayfin 1.36.2 scaffolds write host.json with extensionBundle.id: "Microsoft.Azure.Functions.ExtensionBundle.Preview" and extensionBundle.version: "[4.49.0, 5.0.0)". Existing apps are not migrated; update <services.functions.path>/host.json separately when upgrading. Changed in 1.36.2
rayfin dev functions apply
npx rayfin dev functions apply [--port <port>] [--inspect-port <port>] [--no-debug] [--no-emit-env] [--verbose] [--json] [-y]Verifies prerequisites, merges local settings, starts a local Azure Functions Core Tools host, starts watchers, and writes debugger configuration. Changed in 1.36
Rayfin 1.36.1 and later reduce Functions host restart output to Functions host restarted. and update an existing Functions: Attach debugger entry when the inspector port changes. Changed in 1.36.1
| Option | Default | Description |
|---|---|---|
--port <port> | 7071 | Port for the local function host. Auto-shifts to the nearest free port if taken. |
--inspect-port <port> | 9229 | Port for the Node.js inspector when debugging is enabled. |
--no-debug | Debug on | Disable the Node.js inspector. |
--no-emit-env | Emit env | Skip auto-regenerating framework .env.local from rayfin/.env. |
--verbose | false | Show detailed diagnostic output. |
--json | false | Output JSON. |
-y, --yes | false | Run without interactive prompts. |
rayfin up functions deploy
npx rayfin up functions deploy [-v | --verbose] [--skip-build] [--json]Builds, packages, and deploys functions to an existing remote Rayfin item.
| Option | Default | Description |
|---|---|---|
-v, --verbose | false | Enable verbose output. |
--skip-build | false | Skip the build command and deploy existing content. |
--json | false | Output the result as JSON. |
This command uploads code only. It does not validate or apply services.functions.auth.type to the remote app; run a full npx rayfin up after changing Functions auth settings.
Related rayfin up flags
| Command or flag | Description |
|---|---|
npx rayfin up | Full app deploy. Deploys Functions when enabled and not excluded. |
npx rayfin up --exclude-services functions | Skip the functions build/package/deploy phase. Runtime settings remain unchanged. New in 1.36 |
npx rayfin init --services functions | Scaffold a new app with Functions enabled. New in 1.36 |
Errors
| Error text | Fix |
|---|---|
Not inside a Rayfin project (no `rayfin/` folder). Run this command from your project. | Run the command from a Rayfin project root or pass the project directory. |
Functions service is not enabled. Set 'services.functions.enabled: true' in rayfin.yml and re-run. | Run npx rayfin functions init or enable the service in rayfin.yml. |
Invalid services.functions.auth: authentication is required when Functions are enabled. Set services.functions.auth.type to "application". | Add services.functions.auth.type: application and run full npx rayfin up. |
No active deployment found. Run 'rayfin up' to deploy your Rayfin item first. | Deploy once before running the standalone local Functions host. |
Node.js >= 20 is required. Please upgrade your Node runtime and re-run. | Use Node.js 20 or later. |
Azure Functions Core Tools still not detected on PATH. Open a new shell so PATH updates take effect, then re-run `rayfin dev functions apply`. | Open a new shell and rerun after installing Core Tools. |
In my Rayfin project, set up Functions with the Rayfin 1.36 CLI.
Run `npx rayfin functions init` unless a functions package already exists. If this is an npm-workspace layout, use `--path <relative-path>` or confirm the saved `services.functions.path`. Ensure `services.functions.enabled: true`, `services.functions.auth.type: application`, and `services.functions.buildCommand: npm run build` are present in rayfin/rayfin.yml. Start local debugging with `npx rayfin dev functions apply`, and deploy with full `npx rayfin up` after auth changes or `npx rayfin up functions deploy` for a code-only update. Report exact errors if any command fails.