@neon/skills 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/neon-functions/SKILL.md +38 -9
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "neon-postgres",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.3",
|
|
5
5
|
"description": "Manage your Neon backend with the Neon agent skills and the Neon MCP Server: Lakebase Postgres, Managed Better Auth, Realtime, Object Storage, Functions, the Data API, and AI Gateway",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neon",
|
|
@@ -190,18 +190,20 @@ export default defineConfig({
|
|
|
190
190
|
|
|
191
191
|
Neon injects branch-scoped connection strings and service URLs at runtime — you don't declare these or pass them at deploy time:
|
|
192
192
|
|
|
193
|
-
| Variable
|
|
194
|
-
|
|
|
195
|
-
| `NEON_BRANCH`
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
193
|
+
| Variable | Notes |
|
|
194
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
195
|
+
| `NEON_BRANCH` | The branch **name** (e.g. `main`, `preview/foo`). Injected on every branch, including the default. |
|
|
196
|
+
| `NEON_BRANCH_ID` | The branch **id** (`br-…`). Injected on every branch. |
|
|
197
|
+
| `NEON_FUNCTION_HOST_SUFFIX` | The hostname suffix every function on the branch shares (`.compute.c-2.us-east-2.aws.neon.tech`). See [How to get the function URL](#how-to-get-the-function-url). |
|
|
198
|
+
| `DATABASE_URL` | Pooled connection string. Use for most queries. Present only if the branch has Postgres. |
|
|
199
|
+
| `DATABASE_URL_UNPOOLED` | Direct connection. Use for migrations, `LISTEN`/`NOTIFY`, multi-round-trip transactions. |
|
|
200
|
+
| `NEON_AUTH_BASE_URL` | Present when Neon Auth is enabled on the branch. |
|
|
201
|
+
| `NEON_AUTH_JWKS_URL` | Present when Neon Auth is enabled on the branch. JWKS for verifying Managed Auth JWTs. |
|
|
202
|
+
| `NEON_DATA_API_URL` | Present when the Data API is enabled on the branch. |
|
|
201
203
|
|
|
202
204
|
Object storage (`AWS_*`) and AI Gateway (`NEON_AI_GATEWAY_*`) vars are also injected when those services are declared — see the `neon-object-storage` and `neon-ai-gateway` skills.
|
|
203
205
|
|
|
204
|
-
`neon env pull` / `neon-env run` / `neon dev` emit `NEON_BRANCH` (and the connection strings) into your local dev environment too, so local runs mirror the deployed runtime.
|
|
206
|
+
`neon env pull` / `neon-env run` / `neon dev` emit `NEON_BRANCH`, `NEON_BRANCH_ID`, `NEON_FUNCTION_HOST_SUFFIX` (and the connection strings) into your local dev environment too, so local runs mirror the deployed runtime.
|
|
205
207
|
|
|
206
208
|
**Your own secrets** are per-deployment. Preferred path: declare them in `neon.ts` and run `neon deploy --env <file>`. `<file>` is the gitignored file env pull already writes (`.env` if that file exists, otherwise `.env.local`). Env pull writes Neon-managed vars only; add Function secrets to that file. All declared Function env keys must be present. Omit a key from `neon.ts` if you do not want to write it. `undefined` means you asked to write the key and the value is missing (`defineConfig` throws). Never coerce a missing `process.env` value to an empty string: that uploads `""` and deletes the live key. An empty assignment in the file (`KEY=`) is also `""`. If TypeScript needs an assertion, use `process.env.X!` and make sure the file has the value:
|
|
207
209
|
|
|
@@ -219,6 +221,33 @@ functions: {
|
|
|
219
221
|
|
|
220
222
|
Load Function secrets into the same file env pull wrote, then `neon deploy --env <file>`. Pull the branch's Neon-managed vars onto disk for local dev with `neon env pull` (`link`/`checkout` do this automatically; pass `--no-env-pull` to skip and use `neon-env run -- <cmd>` for runtime injection). Limits: ≤1,000 vars, ≤64 KiB total, and the `NEON_` prefix is reserved.
|
|
221
223
|
|
|
224
|
+
## How to get the function URL
|
|
225
|
+
|
|
226
|
+
A function answers at `https://<NEON_BRANCH_ID>-<slug><NEON_FUNCTION_HOST_SUFFIX>`, for example `https://br-cool-lab-a1b2c3d4-todos.compute.c-2.us-east-2.aws.neon.tech`. Each branch has its own URL.
|
|
227
|
+
|
|
228
|
+
**From a terminal:** `neon functions get <slug>` prints it as `invocation_url`. `neon deploy` prints it for each function it deploys.
|
|
229
|
+
|
|
230
|
+
**From code** (another function, a script, or an app after `neon env pull`): call `functionBaseUrl(slug)` from `@neon/env` (2.0.0 or later). It returns the base URL with no trailing slash:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { functionBaseUrl } from "@neon/env";
|
|
234
|
+
|
|
235
|
+
const res = await fetch(`${functionBaseUrl("todos")}/api/todos`);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
| Where the code runs | `functionBaseUrl("todos")` returns |
|
|
239
|
+
| ------------------------------------------ | --------------------------------------------------- |
|
|
240
|
+
| A deployed function on the branch | `https://<branch_id>-todos.compute.…` (runtime env) |
|
|
241
|
+
| An app or script after `neon env pull` | the same URL, from the pulled env |
|
|
242
|
+
| `neon dev`, when it serves `todos` | `http://localhost:<port>` |
|
|
243
|
+
| `neon dev`, when it does not serve `todos` | the deployed URL on the linked branch |
|
|
244
|
+
|
|
245
|
+
It reads `process.env` by default. Pass the two variables explicitly when they come from elsewhere: `functionBaseUrl("todos", { NEON_BRANCH_ID, NEON_FUNCTION_HOST_SUFFIX })`. It throws when either variable is missing; run `neon env pull` (or `neon env pull -s functions` for only the branch variables) to fix that locally. The function does not have to be deployed for the URL to resolve, but the request fails until it is.
|
|
246
|
+
|
|
247
|
+
Browser code has no access to these variables. Build the URL on the server with `functionBaseUrl` and pass it to the client.
|
|
248
|
+
|
|
249
|
+
Older releases wrote one `NEON_FUNCTION_<SLUG>_BASE_URL` per function and exposed `env.functions.<slug>.baseUrl`. `neon` 9 and `@neon/env` 2 removed both, and `neon env pull` deletes those lines. Replace them with `functionBaseUrl("<slug>")`.
|
|
250
|
+
|
|
222
251
|
## Connecting to Postgres
|
|
223
252
|
|
|
224
253
|
When the branch has Postgres, Neon **injects the connection strings at runtime** — you don't declare them, pass them at deploy time, or hardcode anything. The two you'll use:
|