diff --git a/plugins/shared/skills/resources_graphql/SKILL.md b/plugins/shared/skills/resources_graphql/SKILL.md index f039d2c..491c8e2 100644 --- a/plugins/shared/skills/resources_graphql/SKILL.md +++ b/plugins/shared/skills/resources_graphql/SKILL.md @@ -79,7 +79,7 @@ import { createProxyFetch } from "@major-tech/resource-client/next"; const client = new ApolloClient({ link: new HttpLink({ - uri: "/", // proxy resolves to the resource's configured endpoint + uri: () => "", // use the configured endpoint without adding a slash fetch: createProxyFetch({ baseUrl: process.env.MAJOR_API_BASE_URL!, resourceId: "", @@ -92,7 +92,7 @@ const client = new ApolloClient({ **Key points:** -- **`uri: "/"`** — the proxy reads the endpoint from the resource at request time; you do not (and should not) hardcode the upstream URL on the client. +- **`proxyFetch("")`** uses the configured endpoint without adding a slash. In Apollo use `uri: () => ""`; plain `uri: ""` falls back to `/graphql`. - **Auth is injected server-side** — never set `Authorization` on the Apollo link; the proxy strips reserved request headers and replaces them with the resource's configured auth (`bearer`, `apiKey`, or `none`). - **Resource ID must be static** — `createProxyFetch` is detected by the query extractor only when `resourceId` is a string literal; dynamic IDs are skipped at deploy time. - **Next.js**: use Apollo on the server (RSC, Route Handlers, Server Actions) so the JWT stays out of the browser. For client-side Apollo, route the request through your own server endpoint.