## Common errors Import and manifest errors (path `/items//spec/...`): | Message | Fix | |---|---| | https only (`APP_URL_INVALID`) | Use https | | origin must equal the URL origin (`APP_URL_INVALID`) | Set `origin` to scheme, host and port of `url`, no trailing slash | | the app origin must differ from this platform's own address (`APP_URL_INVALID`) | Host the app on its own host name | | the host is hard-blocked (loopback, link-local or metadata) (`APP_URL_INVALID`) | Use a real DNS name | | placeholder {{x}} is not allowed (only {{workspace}}) (`APP_URL_INVALID`) | Only `{{workspace}}` | | credentials in the URL are not allowed / fragments are not allowed | Remove `user:pass@` and `#...` | | unknown capability '...' (`APP_CAPABILITY_UNKNOWN`) | Use the capability list. Dataset ids have no dashes | | a bare wildcard is not allowed (`APP_EGRESS_WILDCARD`) | `api.example.com` or `*.example.com` | | sandbox token '...' is not allowed | Only the five tokens listed | | must have required property 'sso' | Add `sso` | | warning `APP_WORKSPACE_PLACEHOLDER_EMPTY` | Add `"workspace"` to `sso.scopes`, or drop `{{workspace}}` from the URL | | `APP_ID_TAKEN`: The app id '...' is already used by the active pack '...' | Retire that pack, or use another app id | Runtime errors: | Code | Message | Fix | |---|---|---| | `FEATURE_NOT_LICENSED` | Embedded apps are not included in the licence of this installation. | The installation needs the Embedded apps licence feature | | `APP_NOT_FOUND` | App '...' is not active in this workspace. | Activate the pack for this workspace | | `APP_ORIGIN_UNAPPROVED`, `APP_CAPABILITIES_CHANGED` | App '...' has changes an administrator must approve first. | Approve under Manage app | | `APP_SECRET_MISSING` | App '...' has no app secret yet. | Create the app secret | | `APP_EMBED_REFUSED` | The app has not allowed this platform to embed it (frame-ancestors). Reason `no_csp`, `not_allowed`, `xfo`, `unreachable` or `egress` | Fix the header, remove `X-Frame-Options`, or allow the origin in the network rules | | `APP_INTROSPECT_UNAUTHORIZED` (401) | Introspection is not authorised. | Send HTTP Basic with the app id and the current app secret | | `SSO_NOT_ENABLED` (409) | This app does not use sign-in by one-time code. | Set `sso.mode: "code"` | | `APP_SESSION_INVALID` | The app session is not valid. | Reopen the app | | `APP_PKCE_REQUIRED` | A PKCE challenge is required: a codeChallenge of 43 base64url characters. | Send an S256 challenge | | `APP_AUTHORIZE_RATE_LIMITED` | Too many sign-in codes were requested for this app session. | Renew only when introspection says inactive | | `CAPABILITY_NOT_DECLARED` | The app did not declare '...'. | Declare it and ship a new version | | `CAPABILITY_FORBIDDEN` | '...' is not approved for this app session. / Your seat lacks ... in this workspace. | Approve it, or give the user the permission | | `APP_WRITE_MODE_INVALID` | Apps may only append or upsert. | Use `append` or `upsert` | | `APP_WRITE_ROWS_INVALID` | rows must be a non-empty array. | | | `NAVIGATE_REFUSED` | | Use an AANCER path such as `/dashboards/...` | | `BRIDGE_UNAVAILABLE` | | AANCER could not be reached; retry | | token `invalid_client` (401) | Client authentication failed: send HTTP Basic with the app id and the app secret. | Check `APP_ID` and `APP_SECRET` | | token `invalid_grant` (400) | The code is not valid (unknown, expired, already used, or not issued for this app and verifier). | Get a new code through `authorize` | | token `invalid_request` (400) | code and code_verifier are required; the verifier is 43 to 128 unreserved characters. | | | token `unsupported_grant_type` (400) | Only grant_type=authorization_code is supported. | | | token `429` | Too many failed attempts from this address. | Wait a minute, then retry with the correct app secret | | token `503` | The sign-in service is briefly unavailable. | Retry | ## Limits and editions - Up to 20 capabilities and 20 extra hosts per app. The sign-in code lives 60 seconds; tokens live 5 minutes by default. - Embedded apps need the Embedded apps licence feature. Without it, apps do not show and their calls are refused. - Users need `apps.view_own`. Approving needs `apps.manage_own`, or `extensions.manage` for install-scoped apps. - Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing). ## Connectors A connector is an integration with one external system: actions (a workflow step calls them) and triggers (they start a workflow). Workflows, agents, chat tools and knowledge sources use them. AANCER offers 750+ connectors. Most of them come from the connector library that ships with each release, and an administrator installs them from the catalog with one click and no restart. You can build your own connector for a system that is not covered, such as an in-house ERP or a regional service. You write it in TypeScript against the AANCER connector framework (`@aancer/connector-framework`), run each step on your machine, check it against the certification build's rules, package it as a **connector pack**, sign it with your developer key and install it on your developer edition. A connector pack is a signed pack with exactly one `connector` item, which `aancer-pack` builds from your code. Connector code runs inside AANCER, so the rules are stricter than for other packs: - **Customer editions (every edition except the developer edition)** load only connector packs signed with the platform key, that is, certified by AANCER. Any other signer is refused with `PACK_SIGNER_NOT_ALLOWED`. - **The developer edition** also loads a connector pack signed with **your developer key**, and only while all of these hold, checked again on every import, activation and runner load: 1. the installation is a developer edition; 2. the active licence is a verified developer licence, not withdrawn; 3. that licence was issued for this installation's fingerprint; 4. your key is under Trust keys **ticked as a developer key**, unchanged since the import. Removing your key under Trust keys, or unticking it, stops the connectors it signed at the next load. To ship a connector to customers, submit it for certification. Outbound network access is denied by default. A connector reaches only the hosts it declares, and only through a saved connection whose outbound access is switched on. ## The framework The framework package comes with the developer kit. Install it from the kit file: ```bash npm install /absolute/path/to/aancer-connector-framework-.tgz ``` The package version is the framework version of the automation runner it was taken from, so a connector compiles against the code that will run it. It ships one declaration file, `connector-framework.d.ts`, that resolves with `moduleResolution` `node10` and `node16`, and `STABILITY.md` (see Stability below). The documented names: | Name | What it is | |---|---| | `createConnector({ displayName, description, logoUrl, authors, auth, actions, triggers, minimumSupportedRelease? })` | the connector; export its result from `src/index.ts` | | `createAction({ auth, name, displayName, description, props, run })` | one action. `run(ctx)` returns the step's output | | `createTrigger({ auth, name, displayName, description, type, props, sampleData, onEnable, onDisable, run, test, … })` | one trigger | | `TriggerStrategy.POLLING`, `TriggerStrategy.WEBHOOK` | how a trigger is started | | `ConnectorAuth.SecretText`, `.CustomAuth`, `.BasicAuth`, `.OAuth2` | what an administrator enters once per connection | | `Property.ShortText`, `.LongText`, `.Number`, `.Dropdown`, … | the inputs of a step | | `StoreScope`, `WebhookHandshakeStrategy`, `WebhookRenewStrategy`, `OAuth2AuthorizationMethod`, `OAuth2GrantType` | options | What a step's `run(ctx)` gets: `auth` (the connection), `propsValue` (the inputs), `store` (`put`, `get`, `delete`, kept between runs), `files`, `server`, `webhookUrl`, `payload`. Older names (`createPiece`, `PieceAuth`) are the same functions and still work; they are marked deprecated in the declarations. Use the names above. Names you write in a pack (the installation maps them to its internal names; the old spellings are still accepted, and both spellings with different values are refused): | Where | Write | |---|---| | connector package name | `@aancer/connector-` | | connector item of a pack | `connectorName`, `connectorVersion` | | a workflow template step that calls a connector | `connectorName`, `connectorAction` | | a template that starts from a connector trigger | `triggerType: "connector"`, `triggerConnector`, `triggerName` | ## Quick start ```bash aancer-pack init connector my-items ``` ```text wrote /…/my-items — next: cd /…/my-items && npm install && npm run build, then aancer-pack connector run create_item --props test/props.create_item.json --auth test/auth.json ``` The name must match `^[a-z0-9][a-z0-9-]{1,62}$`; it becomes the package `@aancer/connector-my-items`. You get: ```text my-items/ package.json @aancer/connector-my-items 0.1.0, depends on @aancer/connector-framework, TypeScript tsconfig.json node16 modules, strict, output in dist/ pack.json displayName, description, category, egressHosts .gitignore node_modules/, dist/, .aancer-run/, test/auth.json src/index.ts createConnector(...) src/auth.ts ConnectorAuth.CustomAuth: API key + optional base URL, a validate() call, a call() helper with timeout and retries src/lib/list-items.ts action list_items (follows the API's pages) src/lib/create-item.ts action create_item src/lib/new-item.ts polling trigger new_item (keeps the last seen time in the store) test/props.create_item.json test/auth.example.json README.md ``` Then: ```bash cd my-items npm install /absolute/path/to/aancer-connector-framework-.tgz npm install npm run build # → dist/src/index.js ``` ## Run and check it on your machine ### `connector run`: one step, locally ```bash cp test/auth.example.json test/auth.json # a key for a test account; auth.json stays out of git aancer-pack connector run create_item --props test/props.create_item.json --auth test/auth.json aancer-pack connector run list_items --auth test/auth.json aancer-pack connector run new_item --hook test --auth test/auth.json aancer-pack connector run new_item --hook enable --auth test/auth.json ``` For a webhook trigger, `--payload ` gives the request the trigger receives (`{ "body", "headers", "queryParams" }`). It loads the **built** connector (`dist/src/index.js`; otherwise exit 2 "build the connector first"), fills `propsValue` as the runner does (defaults for missing values; a missing required value or an unknown property is exit 2 and names the properties), and runs one action, or one hook of a trigger (`--hook run|test|enable|disable`, default `run`). The result is printed as JSON, exit 0. If the step throws, it prints ` failed: ` with the stack frames of your project and exits 1. The local stand-in: the store and written files live under `.aancer-run/` in the project; `server`, `flows` and `project` are local placeholders; agent tools and waitpoints are not available (they throw). Your step reaches the real network: point `baseUrl` at a sandbox. `--auth` takes a JSON string for a secret-text key, or the fields (`{ "apiKey": …, "baseUrl": … }`) for custom auth, `{ "username", "password" }` for basic auth, or a complete connection value with a `type`. ### `connector check`: the certification build's rules ```bash aancer-pack connector check aancer-pack connector check --json ``` ```text OK: @aancer/connector-my-items 0.1.0 meets the certification build rules ( runtime packages, files, bytes) ``` It needs `npm` and access to the npm registry (it runs `npm ci` and `npm audit` in a temporary copy). It refuses, one line per problem, exit 2: - inputs: the package name is not `@aancer/connector-`, the version is not strict `x.y.z`, a `pack.json` field breaks the pack.json rules below, no dependency on `@aancer/connector-framework`, `package-lock.json` missing (commit it); - the runtime dependencies: an `install`, `preinstall`, `postinstall` or `prepare` script (`prepare` is accepted for a package from a registry tarball), a native add-on (`*.node`, `binding.gyp`, `prebuilds/`), a symlink, a copy of the framework inside, a licence outside MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0, 0BSD, any known vulnerability, more than 2,000 packages, more than 20,000 files, a file over 32 MiB, more than 128 MiB in total; - the build: `dist/src/index.js` missing, or compiled code that names the framework other than as a plain `require("@aancer/connector-framework")` (no subpath, no ESM `import`, no `.mjs`). The framework comes from a local `.tgz`. A relative `file:` path to it (for example `npm i ../../fw.tgz`) works from any folder depth: `connector check` rebuilds the same relative layout in its temporary folder before `npm ci`. Next part: https://aancer.ai/dev/parts/reference/15-reference-connectors.md