{ "id": 0, "name": "@supabase/functions-js", "variant": "project", "kind": 1, "flags": {}, "children": [ { "id": 69, "name": "FunctionRegion", "variant": "declaration", "kind": 8, "flags": {}, "children": [ { "id": 70, "name": "Any", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 88, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L88" } ], "type": { "type": "literal", "value": "any" } }, { "id": 71, "name": "ApNortheast1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 89, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L89" } ], "type": { "type": "literal", "value": "ap-northeast-1" } }, { "id": 72, "name": "ApNortheast2", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 90, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L90" } ], "type": { "type": "literal", "value": "ap-northeast-2" } }, { "id": 73, "name": "ApSouth1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 91, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L91" } ], "type": { "type": "literal", "value": "ap-south-1" } }, { "id": 74, "name": "ApSoutheast1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 92, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L92" } ], "type": { "type": "literal", "value": "ap-southeast-1" } }, { "id": 75, "name": "ApSoutheast2", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 93, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L93" } ], "type": { "type": "literal", "value": "ap-southeast-2" } }, { "id": 76, "name": "CaCentral1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 94, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L94" } ], "type": { "type": "literal", "value": "ca-central-1" } }, { "id": 77, "name": "EuCentral1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 95, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L95" } ], "type": { "type": "literal", "value": "eu-central-1" } }, { "id": 78, "name": "EuWest1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 96, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L96" } ], "type": { "type": "literal", "value": "eu-west-1" } }, { "id": 79, "name": "EuWest2", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 97, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L97" } ], "type": { "type": "literal", "value": "eu-west-2" } }, { "id": 80, "name": "EuWest3", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 98, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L98" } ], "type": { "type": "literal", "value": "eu-west-3" } }, { "id": 81, "name": "SaEast1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 99, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L99" } ], "type": { "type": "literal", "value": "sa-east-1" } }, { "id": 82, "name": "UsEast1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 100, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L100" } ], "type": { "type": "literal", "value": "us-east-1" } }, { "id": 83, "name": "UsWest1", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 101, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L101" } ], "type": { "type": "literal", "value": "us-west-1" } }, { "id": 84, "name": "UsWest2", "variant": "declaration", "kind": 16, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 102, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L102" } ], "type": { "type": "literal", "value": "us-west-2" } } ], "groups": [ { "title": "Enumeration Members", "children": [70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 87, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L87" } ] }, { "id": 1, "name": "FunctionsClient", "variant": "declaration", "kind": 128, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Client for invoking Supabase Edge Functions." } ] }, "children": [ { "id": 2, "name": "constructor", "variant": "declaration", "kind": 512, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 46, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L46" } ], "signatures": [ { "id": 3, "name": "FunctionsClient", "variant": "signature", "kind": 16384, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Creates a new Functions client bound to an Edge Functions URL." } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsClient, FunctionRegion } from '@supabase/functions-js'\n\nconst functions = new FunctionsClient('https://xyzcompany.supabase.co/functions/v1', {\n headers: { apikey: 'public-anon-key' },\n region: FunctionRegion.UsEast1,\n})\n```" } ] }, { "tag": "@category", "content": [ { "kind": "text", "text": "Functions" } ] }, { "tag": "@example", "name": "Creating a Functions client", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsClient, FunctionRegion } from '@supabase/functions-js'\n\nconst functions = new FunctionsClient('https://xyzcompany.supabase.co/functions/v1', {\n headers: { apikey: 'public-anon-key' },\n region: FunctionRegion.UsEast1,\n})\n```" } ] } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 46, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L46" } ], "parameters": [ { "id": 4, "name": "url", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "string" } }, { "id": 5, "name": "__namedParameters", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "reflection", "declaration": { "id": 6, "name": "__type", "variant": "declaration", "kind": 65536, "flags": {}, "children": [ { "id": 8, "name": "customFetch", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 54, "character": 6, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L54" } ], "type": { "type": "reflection", "declaration": { "id": 9, "name": "__type", "variant": "declaration", "kind": 65536, "flags": {}, "sources": [ { "fileName": "node_modules/typescript/lib/lib.dom.d.ts", "line": 29329, "character": 17 }, { "fileName": "node_modules/@types/node/globals.d.ts", "line": 289, "character": 13 } ], "signatures": [ { "id": 10, "name": "__type", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "[MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch)" } ] }, "sources": [ { "fileName": "node_modules/typescript/lib/lib.dom.d.ts", "line": 29329, "character": 17 } ], "parameters": [ { "id": 11, "name": "input", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "union", "types": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInfo" }, "name": "RequestInfo", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "URL" }, "name": "URL", "package": "typescript" } ] } }, { "id": 12, "name": "init", "variant": "param", "kind": 32768, "flags": { "isOptional": true }, "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInit" }, "name": "RequestInit", "package": "typescript" } } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Promise" }, "typeArguments": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Response" }, "name": "Response", "package": "typescript" } ], "name": "Promise", "package": "typescript" } }, { "id": 13, "name": "__type", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "[MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch)" } ] }, "sources": [ { "fileName": "node_modules/@types/node/globals.d.ts", "line": 289, "character": 13 } ], "parameters": [ { "id": 14, "name": "input", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "union", "types": [ { "type": "intrinsic", "name": "string" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Request" }, "name": "Request", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "URL" }, "name": "URL", "package": "typescript" } ] } }, { "id": 15, "name": "init", "variant": "param", "kind": 32768, "flags": { "isOptional": true }, "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInit" }, "name": "RequestInit", "package": "typescript" } } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Promise" }, "typeArguments": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Response" }, "name": "Response", "package": "typescript" } ], "name": "Promise", "package": "typescript" } } ] } } }, { "id": 7, "name": "headers", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 53, "character": 6, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L53" } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Record" }, "typeArguments": [ { "type": "intrinsic", "name": "string" }, { "type": "intrinsic", "name": "string" } ], "name": "Record", "package": "typescript" }, "defaultValue": "{}" }, { "id": 16, "name": "region", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 55, "character": 6, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L55" } ], "type": { "type": "reference", "target": 69, "name": "FunctionRegion", "package": "@supabase/functions-js" }, "defaultValue": "FunctionRegion.Any" } ], "groups": [ { "title": "Properties", "children": [8, 7, 16] } ], "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 52, "character": 7, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L52" } ] } }, "defaultValue": "{}" } ], "type": { "type": "reference", "target": 1, "name": "FunctionsClient", "package": "@supabase/functions-js" } } ] }, { "id": 20, "name": "fetch", "variant": "declaration", "kind": 1024, "flags": { "isProtected": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 19, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L19" } ], "type": { "type": "reflection", "declaration": { "id": 21, "name": "__type", "variant": "declaration", "kind": 65536, "flags": {}, "sources": [ { "fileName": "node_modules/typescript/lib/lib.dom.d.ts", "line": 29329, "character": 17 }, { "fileName": "node_modules/@types/node/globals.d.ts", "line": 289, "character": 13 } ], "signatures": [ { "id": 22, "name": "__type", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "[MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch)" } ] }, "sources": [ { "fileName": "node_modules/typescript/lib/lib.dom.d.ts", "line": 29329, "character": 17 } ], "parameters": [ { "id": 23, "name": "input", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "union", "types": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInfo" }, "name": "RequestInfo", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "URL" }, "name": "URL", "package": "typescript" } ] } }, { "id": 24, "name": "init", "variant": "param", "kind": 32768, "flags": { "isOptional": true }, "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInit" }, "name": "RequestInit", "package": "typescript" } } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Promise" }, "typeArguments": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Response" }, "name": "Response", "package": "typescript" } ], "name": "Promise", "package": "typescript" } }, { "id": 25, "name": "__type", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "[MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch)" } ] }, "sources": [ { "fileName": "node_modules/@types/node/globals.d.ts", "line": 289, "character": 13 } ], "parameters": [ { "id": 26, "name": "input", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "union", "types": [ { "type": "intrinsic", "name": "string" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Request" }, "name": "Request", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "URL" }, "name": "URL", "package": "typescript" } ] } }, { "id": 27, "name": "init", "variant": "param", "kind": 32768, "flags": { "isOptional": true }, "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "RequestInit" }, "name": "RequestInit", "package": "typescript" } } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Promise" }, "typeArguments": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Response" }, "name": "Response", "package": "typescript" } ], "name": "Promise", "package": "typescript" } } ] } } }, { "id": 18, "name": "headers", "variant": "declaration", "kind": 1024, "flags": { "isProtected": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 17, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L17" } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Record" }, "typeArguments": [ { "type": "intrinsic", "name": "string" }, { "type": "intrinsic", "name": "string" } ], "name": "Record", "package": "typescript" } }, { "id": 19, "name": "region", "variant": "declaration", "kind": 1024, "flags": { "isProtected": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 18, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L18" } ], "type": { "type": "reference", "target": 69, "name": "FunctionRegion", "package": "@supabase/functions-js" } }, { "id": 17, "name": "url", "variant": "declaration", "kind": 1024, "flags": { "isProtected": true }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 16, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L16" } ], "type": { "type": "intrinsic", "name": "string" } }, { "id": 31, "name": "invoke", "variant": "declaration", "kind": 2048, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 204, "character": 8, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L204" } ], "signatures": [ { "id": 32, "name": "invoke", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Invokes a function" } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nconst { data, error } = await functions.invoke('hello-world', {\n body: { name: 'Ada' },\n})\n```" } ] }, { "tag": "@category", "content": [ { "kind": "text", "text": "Functions" } ] }, { "tag": "@remarks", "content": [ { "kind": "text", "text": "- Requires an Authorization header.\n- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.\n- When you pass in a body to your function, we automatically attach the Content-Type header for " }, { "kind": "code", "text": "`Blob`" }, { "kind": "text", "text": ", " }, { "kind": "code", "text": "`ArrayBuffer`" }, { "kind": "text", "text": ", " }, { "kind": "code", "text": "`File`" }, { "kind": "text", "text": ", " }, { "kind": "code", "text": "`FormData`" }, { "kind": "text", "text": " and " }, { "kind": "code", "text": "`String`" }, { "kind": "text", "text": ". If it doesn't match any of these types we assume the payload is " }, { "kind": "code", "text": "`json`" }, { "kind": "text", "text": ", serialize it and attach the " }, { "kind": "code", "text": "`Content-Type`" }, { "kind": "text", "text": " header as " }, { "kind": "code", "text": "`application/json`" }, { "kind": "text", "text": ". You can override this behavior by passing in a " }, { "kind": "code", "text": "`Content-Type`" }, { "kind": "text", "text": " header of your own.\n- Responses are automatically parsed as " }, { "kind": "code", "text": "`json`" }, { "kind": "text", "text": ", " }, { "kind": "code", "text": "`blob`" }, { "kind": "text", "text": " and " }, { "kind": "code", "text": "`form-data`" }, { "kind": "text", "text": " depending on the " }, { "kind": "code", "text": "`Content-Type`" }, { "kind": "text", "text": " header sent by your function. Responses are parsed as " }, { "kind": "code", "text": "`text`" }, { "kind": "text", "text": " by default." } ] }, { "tag": "@example", "name": "Basic invocation", "content": [ { "kind": "code", "text": "```js\nconst { data, error } = await supabase.functions.invoke('hello', {\n body: { foo: 'bar' }\n})\n```" } ] }, { "tag": "@exampleDescription", "content": [ { "kind": "text", "text": "Error handling\nA " }, { "kind": "code", "text": "`FunctionsHttpError`" }, { "kind": "text", "text": " error is returned if your function throws an error, " }, { "kind": "code", "text": "`FunctionsRelayError`" }, { "kind": "text", "text": " if the Supabase Relay has an error processing your function and " }, { "kind": "code", "text": "`FunctionsFetchError`" }, { "kind": "text", "text": " if there is a network error in calling your function." } ] }, { "tag": "@example", "name": "Error handling", "content": [ { "kind": "code", "text": "```js\nimport { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError } from \"@supabase/supabase-js\";\n\nconst { data, error } = await supabase.functions.invoke('hello', {\n headers: {\n \"my-custom-header\": 'my-custom-header-value'\n },\n body: { foo: 'bar' }\n})\n\nif (error instanceof FunctionsHttpError) {\n const errorMessage = await error.context.json()\n console.log('Function returned an error', errorMessage)\n} else if (error instanceof FunctionsRelayError) {\n console.log('Relay error:', error.message)\n} else if (error instanceof FunctionsFetchError) {\n console.log('Fetch error:', error.message)\n}\n```" } ] }, { "tag": "@exampleDescription", "content": [ { "kind": "text", "text": "Passing custom headers\nYou can pass custom headers to your function. Note: supabase-js automatically passes the " }, { "kind": "code", "text": "`Authorization`" }, { "kind": "text", "text": " header with the signed in user's JWT." } ] }, { "tag": "@example", "name": "Passing custom headers", "content": [ { "kind": "code", "text": "```js\nconst { data, error } = await supabase.functions.invoke('hello', {\n headers: {\n \"my-custom-header\": 'my-custom-header-value'\n },\n body: { foo: 'bar' }\n})\n```" } ] }, { "tag": "@exampleDescription", "content": [ { "kind": "text", "text": "Calling with DELETE HTTP verb\nYou can also set the HTTP verb to " }, { "kind": "code", "text": "`DELETE`" }, { "kind": "text", "text": " when calling your Edge Function." } ] }, { "tag": "@example", "name": "Calling with DELETE HTTP verb", "content": [ { "kind": "code", "text": "```js\nconst { data, error } = await supabase.functions.invoke('hello', {\n headers: {\n \"my-custom-header\": 'my-custom-header-value'\n },\n body: { foo: 'bar' },\n method: 'DELETE'\n})\n```" } ] }, { "tag": "@exampleDescription", "content": [ { "kind": "text", "text": "Invoking a Function in the UsEast1 region\nHere are the available regions:\n- " }, { "kind": "code", "text": "`FunctionRegion.Any`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.ApNortheast1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.ApNortheast2`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.ApSouth1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.ApSoutheast1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.ApSoutheast2`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.CaCentral1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.EuCentral1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.EuWest1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.EuWest2`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.EuWest3`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.SaEast1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.UsEast1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.UsWest1`" }, { "kind": "text", "text": "\n- " }, { "kind": "code", "text": "`FunctionRegion.UsWest2`" } ] }, { "tag": "@example", "name": "Invoking a Function in the UsEast1 region", "content": [ { "kind": "code", "text": "```js\nimport { createClient, FunctionRegion } from '@supabase/supabase-js'\n\nconst { data, error } = await supabase.functions.invoke('hello', {\n body: { foo: 'bar' },\n region: FunctionRegion.UsEast1\n})\n```" } ] }, { "tag": "@exampleDescription", "content": [ { "kind": "text", "text": "Calling with GET HTTP verb\nYou can also set the HTTP verb to " }, { "kind": "code", "text": "`GET`" }, { "kind": "text", "text": " when calling your Edge Function." } ] }, { "tag": "@example", "name": "Calling with GET HTTP verb", "content": [ { "kind": "code", "text": "```js\nconst { data, error } = await supabase.functions.invoke('hello', {\n headers: {\n \"my-custom-header\": 'my-custom-header-value'\n },\n method: 'GET'\n})\n```" } ] }, { "tag": "@example", "name": "Example 7", "content": [ { "kind": "code", "text": "```ts\nconst { data, error } = await functions.invoke('hello-world', {\n body: { name: 'Ada' },\n})\n```" } ] } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 204, "character": 8, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L204" } ], "typeParameters": [ { "id": 33, "name": "T", "variant": "typeParam", "kind": 131072, "flags": {}, "default": { "type": "intrinsic", "name": "any" } } ], "parameters": [ { "id": 34, "name": "functionName", "variant": "param", "kind": 32768, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "The name of the Function to invoke." } ] }, "type": { "type": "intrinsic", "name": "string" } }, { "id": 35, "name": "options", "variant": "param", "kind": 32768, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Options for invoking the Function." } ] }, "type": { "type": "reference", "target": 36, "name": "FunctionInvokeOptions", "package": "@supabase/functions-js" }, "defaultValue": "{}" } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Promise" }, "typeArguments": [ { "type": "reference", "target": 85, "typeArguments": [ { "type": "reference", "target": 33, "name": "T", "package": "@supabase/functions-js", "refersToTypeParameter": true } ], "name": "FunctionsResponse", "package": "@supabase/functions-js" } ], "name": "Promise", "package": "typescript" } } ] }, { "id": 28, "name": "setAuth", "variant": "declaration", "kind": 2048, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 75, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L75" } ], "signatures": [ { "id": 29, "name": "setAuth", "variant": "signature", "kind": 4096, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Updates the authorization header" } ], "blockTags": [ { "tag": "@category", "content": [ { "kind": "text", "text": "Functions" } ] }, { "tag": "@example", "name": "Setting the authorization header", "content": [ { "kind": "code", "text": "```ts\nfunctions.setAuth(session.access_token)\n```" } ] } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 75, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L75" } ], "parameters": [ { "id": 30, "name": "token", "variant": "param", "kind": 32768, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "the new jwt token sent in the authorisation header" } ] }, "type": { "type": "intrinsic", "name": "string" } } ], "type": { "type": "intrinsic", "name": "void" } } ] } ], "groups": [ { "title": "Constructors", "children": [2] }, { "title": "Properties", "children": [20, 18, 19, 17] }, { "title": "Methods", "children": [31, 28] } ], "categories": [ { "title": "Functions", "children": [2, 31, 28] }, { "title": "Other", "children": [20, 18, 19, 17] } ], "sources": [ { "fileName": "packages/core/functions-js/src/FunctionsClient.ts", "line": 15, "character": 13, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/FunctionsClient.ts#L15" } ] }, { "id": 47, "name": "FunctionsError", "variant": "declaration", "kind": 128, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Base error for Supabase Edge Function invocations." } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsError } from '@supabase/functions-js'\n\nthrow new FunctionsError('Unexpected error invoking function', 'FunctionsError', {\n requestId: 'abc123',\n})\n```" } ] } ] }, "children": [ { "id": 48, "name": "constructor", "variant": "declaration", "kind": 512, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 32, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L32" } ], "signatures": [ { "id": 49, "name": "FunctionsError", "variant": "signature", "kind": 16384, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 32, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L32" } ], "parameters": [ { "id": 50, "name": "message", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "string" } }, { "id": 51, "name": "name", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "string" }, "defaultValue": "'FunctionsError'" }, { "id": 52, "name": "context", "variant": "param", "kind": 32768, "flags": { "isOptional": true }, "type": { "type": "intrinsic", "name": "any" } } ], "type": { "type": "reference", "target": 47, "name": "FunctionsError", "package": "@supabase/functions-js" }, "overwrites": { "type": "reference", "target": -1, "name": "Error.constructor" } } ], "overwrites": { "type": "reference", "target": -1, "name": "Error.constructor" } }, { "id": 53, "name": "context", "variant": "declaration", "kind": 1024, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 31, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L31" } ], "type": { "type": "intrinsic", "name": "any" } } ], "groups": [ { "title": "Constructors", "children": [48] }, { "title": "Properties", "children": [53] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 30, "character": 13, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L30" } ], "extendedTypes": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Error" }, "name": "Error", "package": "typescript" } ], "extendedBy": [ { "type": "reference", "target": 54, "name": "FunctionsFetchError" }, { "type": "reference", "target": 59, "name": "FunctionsHttpError" }, { "type": "reference", "target": 64, "name": "FunctionsRelayError" } ] }, { "id": 54, "name": "FunctionsFetchError", "variant": "declaration", "kind": 128, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Error thrown when the network request to an Edge Function fails." } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsFetchError } from '@supabase/functions-js'\n\nthrow new FunctionsFetchError({ requestId: 'abc123' })\n```" } ] } ] }, "children": [ { "id": 55, "name": "constructor", "variant": "declaration", "kind": 512, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 50, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L50" } ], "signatures": [ { "id": 56, "name": "FunctionsFetchError", "variant": "signature", "kind": 16384, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 50, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L50" } ], "parameters": [ { "id": 57, "name": "context", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "any" } } ], "type": { "type": "reference", "target": 54, "name": "FunctionsFetchError", "package": "@supabase/functions-js" }, "overwrites": { "type": "reference", "target": 49, "name": "FunctionsError.constructor" } } ], "overwrites": { "type": "reference", "target": 48, "name": "FunctionsError.constructor" } }, { "id": 58, "name": "context", "variant": "declaration", "kind": 1024, "flags": { "isInherited": true }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 31, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L31" } ], "type": { "type": "intrinsic", "name": "any" }, "inheritedFrom": { "type": "reference", "target": 53, "name": "FunctionsError.context" } } ], "groups": [ { "title": "Constructors", "children": [55] }, { "title": "Properties", "children": [58] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 49, "character": 13, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L49" } ], "extendedTypes": [ { "type": "reference", "target": 47, "name": "FunctionsError", "package": "@supabase/functions-js" } ] }, { "id": 59, "name": "FunctionsHttpError", "variant": "declaration", "kind": 128, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Error thrown when the Edge Function returns a non-2xx status code." } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsHttpError } from '@supabase/functions-js'\n\nthrow new FunctionsHttpError({ status: 500 })\n```" } ] } ] }, "children": [ { "id": 60, "name": "constructor", "variant": "declaration", "kind": 512, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 82, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L82" } ], "signatures": [ { "id": 61, "name": "FunctionsHttpError", "variant": "signature", "kind": 16384, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 82, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L82" } ], "parameters": [ { "id": 62, "name": "context", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "any" } } ], "type": { "type": "reference", "target": 59, "name": "FunctionsHttpError", "package": "@supabase/functions-js" }, "overwrites": { "type": "reference", "target": 49, "name": "FunctionsError.constructor" } } ], "overwrites": { "type": "reference", "target": 48, "name": "FunctionsError.constructor" } }, { "id": 63, "name": "context", "variant": "declaration", "kind": 1024, "flags": { "isInherited": true }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 31, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L31" } ], "type": { "type": "intrinsic", "name": "any" }, "inheritedFrom": { "type": "reference", "target": 53, "name": "FunctionsError.context" } } ], "groups": [ { "title": "Constructors", "children": [60] }, { "title": "Properties", "children": [63] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 81, "character": 13, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L81" } ], "extendedTypes": [ { "type": "reference", "target": 47, "name": "FunctionsError", "package": "@supabase/functions-js" } ] }, { "id": 64, "name": "FunctionsRelayError", "variant": "declaration", "kind": 128, "flags": {}, "comment": { "summary": [ { "kind": "text", "text": "Error thrown when the Supabase relay cannot reach the Edge Function." } ], "blockTags": [ { "tag": "@example", "content": [ { "kind": "code", "text": "```ts\nimport { FunctionsRelayError } from '@supabase/functions-js'\n\nthrow new FunctionsRelayError({ region: 'us-east-1' })\n```" } ] } ] }, "children": [ { "id": 65, "name": "constructor", "variant": "declaration", "kind": 512, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 66, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L66" } ], "signatures": [ { "id": 66, "name": "FunctionsRelayError", "variant": "signature", "kind": 16384, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 66, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L66" } ], "parameters": [ { "id": 67, "name": "context", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "any" } } ], "type": { "type": "reference", "target": 64, "name": "FunctionsRelayError", "package": "@supabase/functions-js" }, "overwrites": { "type": "reference", "target": 49, "name": "FunctionsError.constructor" } } ], "overwrites": { "type": "reference", "target": 48, "name": "FunctionsError.constructor" } }, { "id": 68, "name": "context", "variant": "declaration", "kind": 1024, "flags": { "isInherited": true }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 31, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L31" } ], "type": { "type": "intrinsic", "name": "any" }, "inheritedFrom": { "type": "reference", "target": 53, "name": "FunctionsError.context" } } ], "groups": [ { "title": "Constructors", "children": [65] }, { "title": "Properties", "children": [68] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 65, "character": 13, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L65" } ], "extendedTypes": [ { "type": "reference", "target": 47, "name": "FunctionsError", "package": "@supabase/functions-js" } ] }, { "id": 36, "name": "FunctionInvokeOptions", "variant": "declaration", "kind": 2097152, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 105, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L105" } ], "type": { "type": "reflection", "declaration": { "id": 37, "name": "__type", "variant": "declaration", "kind": 65536, "flags": {}, "children": [ { "id": 44, "name": "body", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "The body of the request." } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 121, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L121" } ], "type": { "type": "union", "types": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "File" }, "name": "File", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "Blob" }, "name": "Blob", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "ArrayBuffer" }, "name": "ArrayBuffer", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "FormData" }, "name": "FormData", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "ReadableStream" }, "typeArguments": [ { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Uint8Array" }, "name": "Uint8Array", "package": "typescript" } ], "name": "ReadableStream", "package": "typescript" }, { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.es5.d.ts", "qualifiedName": "Record" }, "typeArguments": [ { "type": "intrinsic", "name": "string" }, { "type": "intrinsic", "name": "any" } ], "name": "Record", "package": "typescript" }, { "type": "intrinsic", "name": "string" } ] } }, { "id": 38, "name": "headers", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "Object representing the headers to send with the request." } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 109, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L109" } ], "type": { "type": "reflection", "declaration": { "id": 39, "name": "__type", "variant": "declaration", "kind": 65536, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 109, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L109" } ], "indexSignatures": [ { "id": 40, "name": "__index", "variant": "signature", "kind": 8192, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 109, "character": 14, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L109" } ], "parameters": [ { "id": 41, "name": "key", "variant": "param", "kind": 32768, "flags": {}, "type": { "type": "intrinsic", "name": "string" } } ], "type": { "type": "intrinsic", "name": "string" } } ] } } }, { "id": 42, "name": "method", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "The HTTP verb of the request" } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 113, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L113" } ], "type": { "type": "union", "types": [ { "type": "literal", "value": "POST" }, { "type": "literal", "value": "GET" }, { "type": "literal", "value": "PUT" }, { "type": "literal", "value": "PATCH" }, { "type": "literal", "value": "DELETE" } ] } }, { "id": 43, "name": "region", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "The Region to invoke the function in." } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 117, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L117" } ], "type": { "type": "reference", "target": 69, "name": "FunctionRegion", "package": "@supabase/functions-js" } }, { "id": 45, "name": "signal", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "The AbortSignal to use for the request." } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 132, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L132" } ], "type": { "type": "reference", "target": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "AbortSignal" }, "name": "AbortSignal", "package": "typescript" } }, { "id": 46, "name": "timeout", "variant": "declaration", "kind": 1024, "flags": { "isOptional": true }, "comment": { "summary": [ { "kind": "text", "text": "The timeout for the request in milliseconds.\nIf the function takes longer than this, the request will be aborted." } ] }, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 137, "character": 2, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L137" } ], "type": { "type": "intrinsic", "name": "number" } } ], "groups": [ { "title": "Properties", "children": [44, 38, 42, 43, 45, 46] } ], "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 105, "character": 36, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L105" } ] } } }, { "id": 85, "name": "FunctionsResponse", "variant": "declaration", "kind": 2097152, "flags": {}, "sources": [ { "fileName": "packages/core/functions-js/src/types.ts", "line": 16, "character": 12, "url": "https://github.com/supabase/supabase-js/blob/f26b924d3b21bcac1b2de68f16f9b2c611655432/packages/core/functions-js/src/types.ts#L16" } ], "typeParameters": [ { "id": 86, "name": "T", "variant": "typeParam", "kind": 131072, "flags": {} } ], "type": { "type": "union", "types": [ { "type": "reference", "target": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsResponseSuccess" }, "typeArguments": [ { "type": "reference", "target": 86, "name": "T", "package": "@supabase/functions-js", "refersToTypeParameter": true } ], "name": "FunctionsResponseSuccess", "package": "@supabase/functions-js" }, { "type": "reference", "target": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsResponseFailure" }, "name": "FunctionsResponseFailure", "package": "@supabase/functions-js" } ] } } ], "groups": [ { "title": "Enumerations", "children": [69] }, { "title": "Classes", "children": [1, 47, 54, 59, 64] }, { "title": "Type Aliases", "children": [36, 85] } ], "packageName": "@supabase/functions-js", "readme": [ { "kind": "text", "text": "
\n

\n \n \n \n \n \"Supabase\n \n \n\n

Supabase Functions JS SDK

\n\n

JavaScript SDK to interact with Supabase Edge Functions.

\n\n

\n Guides\n ·\n Reference Docs\n ·\n TypeDoc\n

\n

\n\n
\n\n[![Build](https://github.com/supabase/supabase-js/workflows/CI/badge.svg)](https://github.com/supabase/supabase-js/actions?query=branch%3Amaster)\n[![Package](https://img.shields.io/npm/v/@supabase/functions-js)](https://www.npmjs.com/package/@supabase/functions-js)\n[![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license)\n[![pkg.pr.new](https://pkg.pr.new/badge/supabase/functions-js)](https://pkg.pr.new/~/supabase/functions-js)\n\n
\n\n## Requirements\n\n- **Node.js 20 or later** (Node.js 18 support dropped as of October 31, 2025)\n- For browser support, all modern browsers are supported\n\n> ⚠️ **Node.js 18 Deprecation Notice**\n>\n> Node.js 18 reached end-of-life on April 30, 2025. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/37217), support for Node.js 18 was dropped on October 31, 2025.\n\n## Quick Start\n\n### Installation\n\n" }, { "kind": "code", "text": "```bash\nnpm install @supabase/functions-js\n```" }, { "kind": "text", "text": "\n\n### Usage\n\n" }, { "kind": "code", "text": "```js\nimport { FunctionsClient } from '@supabase/functions-js'\n\nconst functionsUrl = 'https://.supabase.co/functions/v1'\nconst anonKey = ''\n\nconst functions = new FunctionsClient(functionsUrl, {\n headers: {\n Authorization: `Bearer ${anonKey}`,\n },\n})\n\n// Invoke a function\nconst { data, error } = await functions.invoke('hello-world', {\n body: { name: 'Functions' },\n})\n```" }, { "kind": "text", "text": "\n\n## Development\n\nThis package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/supabase-js). To work on this package:\n\n### Building\n\n" }, { "kind": "code", "text": "```bash\n# Complete build (from monorepo root)\nnpx nx build functions-js\n\n# Build with watch mode for development\nnpx nx build functions-js --watch\n\n# Individual build targets\nnpx nx build:main functions-js # CommonJS build (dist/main/)\nnpx nx build:module functions-js # ES Modules build (dist/module/)\n\n# Other useful commands\nnpx nx clean functions-js # Clean build artifacts\nnpx nx typecheck functions-js # TypeScript type checking\nnpx nx docs functions-js # Generate documentation\n```" }, { "kind": "text", "text": "\n\n#### Build Outputs\n\n- **CommonJS (" }, { "kind": "code", "text": "`dist/main/`" }, { "kind": "text", "text": ")** - For Node.js environments\n- **ES Modules (" }, { "kind": "code", "text": "`dist/module/`" }, { "kind": "text", "text": ")** - For modern bundlers (Webpack, Vite, Rollup)\n- **TypeScript definitions (" }, { "kind": "code", "text": "`dist/module/index.d.ts`" }, { "kind": "text", "text": ")** - Type definitions for TypeScript projects\n\n### Testing\n\n**Docker Required** for relay tests. The functions-js tests use testcontainers to spin up a Deno relay server for testing Edge Function invocations.\n\n" }, { "kind": "code", "text": "```bash\n# Run all tests (from monorepo root)\nnpx nx test functions-js\n\n# Run tests with coverage report\nnpx nx test functions-js --coverage\n\n# Run tests in watch mode during development\nnpx nx test functions-js --watch\n\n# CI test command (runs with coverage)\nnpx nx test:ci functions-js\n```" }, { "kind": "text", "text": "\n\n#### Test Requirements\n\n- **Node.js 20+** - Required for testcontainers\n- **Docker** - Must be installed and running for relay tests\n- No Supabase instance needed - Tests use mocked services and testcontainers\n\n#### What Gets Tested\n\n- **Function invocation** - Testing the " }, { "kind": "code", "text": "`invoke()`" }, { "kind": "text", "text": " method with various options\n- **Relay functionality** - Using a containerized Deno relay to test real Edge Function scenarios\n- **Error handling** - Ensuring proper error responses and retries\n- **Request/response models** - Validating headers, body, and response formats\n\n### Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](" }, { "kind": "relative-link", "text": "../../../CONTRIBUTING.md", "target": 2 }, { "kind": "text", "text": ") for details on how to get started.\n\nFor major changes or if you're unsure about something, please open an issue first to discuss your proposed changes." } ], "symbolIdMap": { "0": { "sourceFileName": "src/index.ts", "qualifiedName": "" }, "1": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient" }, "2": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.__constructor" }, "3": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient" }, "4": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "url" }, "5": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "__1" }, "6": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "__type" }, "7": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "__type.headers" }, "8": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "__type.customFetch" }, "9": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "fetch" }, "10": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "fetch" }, "11": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "input" }, "12": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "init" }, "13": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "fetch" }, "14": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "input" }, "15": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "init" }, "16": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "__type.region" }, "17": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.url" }, "18": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.headers" }, "19": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.region" }, "20": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.fetch" }, "21": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "fetch" }, "22": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "fetch" }, "23": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "input" }, "24": { "sourceFileName": "../../../node_modules/typescript/lib/lib.dom.d.ts", "qualifiedName": "init" }, "25": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "fetch" }, "26": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "input" }, "27": { "sourceFileName": "../../../node_modules/@types/node/globals.d.ts", "qualifiedName": "init" }, "28": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.setAuth" }, "29": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.setAuth" }, "30": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "token" }, "31": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.invoke" }, "32": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "FunctionsClient.invoke" }, "33": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "T" }, "34": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "functionName" }, "35": { "sourceFileName": "src/FunctionsClient.ts", "qualifiedName": "options" }, "36": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionInvokeOptions" }, "37": { "sourceFileName": "src/types.ts", "qualifiedName": "__type" }, "38": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.headers" }, "39": { "sourceFileName": "src/types.ts", "qualifiedName": "__type" }, "40": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.__index" }, "42": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.method" }, "43": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.region" }, "44": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.body" }, "45": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.signal" }, "46": { "sourceFileName": "src/types.ts", "qualifiedName": "__type.timeout" }, "47": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError" }, "48": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError.__constructor" }, "49": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError" }, "50": { "sourceFileName": "src/types.ts", "qualifiedName": "message" }, "51": { "sourceFileName": "src/types.ts", "qualifiedName": "name" }, "52": { "sourceFileName": "src/types.ts", "qualifiedName": "context" }, "53": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError.context" }, "54": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsFetchError" }, "55": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsFetchError.__constructor" }, "56": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsFetchError" }, "57": { "sourceFileName": "src/types.ts", "qualifiedName": "context" }, "58": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError.context" }, "59": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsHttpError" }, "60": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsHttpError.__constructor" }, "61": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsHttpError" }, "62": { "sourceFileName": "src/types.ts", "qualifiedName": "context" }, "63": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError.context" }, "64": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsRelayError" }, "65": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsRelayError.__constructor" }, "66": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsRelayError" }, "67": { "sourceFileName": "src/types.ts", "qualifiedName": "context" }, "68": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsError.context" }, "69": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion" }, "70": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.Any" }, "71": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.ApNortheast1" }, "72": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.ApNortheast2" }, "73": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.ApSouth1" }, "74": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.ApSoutheast1" }, "75": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.ApSoutheast2" }, "76": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.CaCentral1" }, "77": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.EuCentral1" }, "78": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.EuWest1" }, "79": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.EuWest2" }, "80": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.EuWest3" }, "81": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.SaEast1" }, "82": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.UsEast1" }, "83": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.UsWest1" }, "84": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionRegion.UsWest2" }, "85": { "sourceFileName": "src/types.ts", "qualifiedName": "FunctionsResponse" }, "86": { "sourceFileName": "src/types.ts", "qualifiedName": "T" } }, "files": { "entries": { "1": "src/index.ts", "2": "../../../CONTRIBUTING.md" }, "reflections": { "1": 0 } } }