{"record":{"id":"5b03913e097e8b80","repo":"unionlabs/union","slug":"no-aptos-rpc-url-found","errorCode":null,"errorMessage":"No Aptos RPC URL found","messagePattern":"No Aptos RPC URL found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"typescript-sdk/src/aptos/client.ts","lineNumber":60,"sourceCode":"): Promise<{ authAccess: \"key\"; aptos: Aptos; signer: AptosAccount }>\n\n// async function getAptosClient(\n//   parameters: AptosClientParameters & { authAccess: \"wallet\" }\n// ): Promise<{ authAccess: \"wallet\"; aptos: Aptos; signer: AptosBrowserWallet }>\n\nasync function getAptosClient(\n  parameters: AptosClientParameters & { authAccess: AuthAccess },\n): Promise<\n  | { authAccess: \"key\"; aptos: Aptos; signer: AptosAccount }\n  | { authAccess: \"wallet\"; aptos: Aptos; signer: AptosBrowserWallet }\n> {\n  if (parameters.authAccess === \"key\") {\n    if (typeof parameters.transport !== \"function\") {\n      throw new Error(\"Invalid Aptos transport\")\n    }\n    const rpcUrl = parameters.transport({}).value?.url\n    if (!rpcUrl) {\n      throw new Error(\"No Aptos RPC URL found\")\n    }\n    const config = new AptosConfig({\n      fullnode: rpcUrl,\n      network: Network.CUSTOM,\n    })\n    return {\n      authAccess: \"key\",\n      aptos: new Aptos(config),\n      signer: parameters.account as AptosAccount,\n    }\n  }\n\n  if (parameters.authAccess === \"wallet\") {\n    if (typeof parameters.transport !== \"object\") {\n      throw new Error(\"Invalid Aptos transport\")\n    }\n    const networkInfo = await parameters.transport.getNetwork()\n    const network = networkInfo.name.toLowerCase() === \"mainnet\" ? Network.MAINNET : Network.TESTNET","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/typescript-sdk/src/aptos/client.ts#L42-L78","documentation":"Thrown by getAptosClient in the Union TypeScript SDK when building an Aptos client with authAccess \"key\". In that mode the SDK expects a viem-style transport function and extracts the RPC URL via transport({}).value?.url; if that call yields no URL, no AptosConfig/fullnode can be constructed, so client creation aborts. It is a configuration error that happens before any network call to Aptos is made.","triggerScenarios":"Calling createUnionClient({ chainId: <aptos chain id>, authAccess: \"key\", transport }) where transport is a function but transport({}).value?.url is undefined or empty. Typical causes: passing a plain URL string or an already-invoked transport object instead of http(url), using a custom transport whose value lacks a url field, or reusing a transport built for a different chain shape.","commonSituations":"Passing transport: \"https://fullnode.mainnet.aptoslabs.com/v1\" instead of http(\"https://...\"); copying a Cosmos/EVM example but swapping only the chainId; a transport factory that returns { config } without { value: { url } }; upgrading viem/SDK versions where the transport return shape changed.","solutions":["Pass a viem-style transport created with http(), e.g. transport: http(\"https://fullnode.mainnet.aptoslabs.com/v1\")","Confirm authAccess is \"key\" only when you want key-based signing; pair it with an account, and use the wallet object (not a transport function) for authAccess \"wallet\"","If using a custom transport, make sure calling it returns an object with value: { url: <fullnode url> }","Verify the fullnode URL is a valid Aptos REST endpoint (usually ends with /v1)"],"exampleFix":"// before\nconst client = createUnionClient({\n  chainId: \"aptos-1\",\n  authAccess: \"key\",\n  account: aptosAccount,\n  transport: \"https://fullnode.mainnet.aptoslabs.com/v1\",\n})\n\n// after\nimport { http } from \"viem\"\n\nconst client = createUnionClient({\n  chainId: \"aptos-1\",\n  authAccess: \"key\",\n  account: aptosAccount,\n  transport: http(\"https://fullnode.mainnet.aptoslabs.com/v1\"),\n})","handlingStrategy":"validation","validationCode":"const transport = http(\"https://fullnode.mainnet.aptoslabs.com/v1\")\nconst probe = typeof transport === \"function\" ? transport({}) : undefined\nconst rpcUrl = probe?.value?.url\nif (!rpcUrl) {\n  throw new Error(\"transport must be http(url) so transport({}).value.url is set\")\n}\nconst client = createUnionClient({ chainId: \"aptos-1\", authAccess: \"key\", account, transport })","typeGuard":"const isKeyTransportWithUrl = (\n  t: unknown,\n): t is () => { value: { url: string } } =>\n  typeof t === \"function\" && Boolean((t as any)({})?.value?.url)","tryCatchPattern":"try {\n  const client = createUnionClient(params)\n} catch (error) {\n  if (error instanceof Error && error.message === \"No Aptos RPC URL found\") {\n    // fix transport to http(fullnodeUrl) and surface a config hint\n  }\n  throw error\n}","preventionTips":["Always construct Aptos key-mode transports with http(<fullnode url ending in /v1>)","Keep authAccess and transport kind paired: \"key\" -> function, \"wallet\" -> wallet object","Centralize client creation in one factory so the transport shape is validated once"],"tags":["aptos","configuration","rpc","typescript-sdk","transport"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}