Environment
- os: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020 arm64
- node: v24.2.0
- orpc: V1.10.2
Reproduction
client
import { createORPCClient } from '@orpc/client'
import { OpenAPILink } from '@orpc/openapi-client/fetch'
import { contract } from './contract'
const link = new OpenAPILink(contract, {
url: '/api',
})
export const client: JsonifiedClient<ContractRouterClient<typeof contract>> = createORPCClient(link)
vite config
export default defineConfig({
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
server: {
proxy: {
"/api": {
target: "http://localhost:3000",
changeOrigin: true,
},
},
},
});
Describe the bug
When configuring OpenAPILink with a relative URL (e.g., /api), the client throws an error:
Current behavior:
The StandardOpenapiLinkCodec uses new URL(baseUrl) which requires an absolute URL. This fails when users provide relative paths.
Expected behavior:
The client should support relative URLs in browser environments, automatically resolving them against location.origin.
Environment
Reproduction
client
vite config
Describe the bug
When configuring OpenAPILink with a relative URL (e.g., /api), the client throws an error:
Current behavior:
The StandardOpenapiLinkCodec uses new URL(baseUrl) which requires an absolute URL. This fails when users provide relative paths.
Expected behavior:
The client should support relative URLs in browser environments, automatically resolving them against location.origin.