fix(ai-gateway): resolve gateway by app id in the path#226
Open
yardend-wix wants to merge 3 commits into
Open
Conversation
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
connection() built the domain-routed gateway URL (${serverUrl}/api/ai/openai/v1),
which requires the request Host to resolve the app. In the browser the SDK
targets the shared host, so a backend function's gateway call lands on a host
that resolves to no app and 404s ("App not found for this domain").
Build the app_id-routed URL instead (${serverUrl}/api/apps/${appId}/ai/openai/v1),
matching how every other runtime module (entities, functions, connectors,
analytics, ...) places appId in the path. The gateway then resolves the app
from the URL regardless of which host the request came in on.
Pairs with the backend app_id mount in base44-dev/apper#15443.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…party SDKs
Replace the Mastra and OpenAI-SDK examples with a single minimal example
showing the connection() -> { baseURL, token } handoff against the
OpenAI-compatible Chat Completions endpoint, and drop specific library names
from the module prose. Keeps the docs client-agnostic ("any OpenAI-compatible
client") instead of pinning third-party SDKs/versions.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4f6024f to
ee4d816
Compare
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.37-pr.226.49a8ffdPrefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.37-pr.226.49a8ffd"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.37-pr.226.49a8ffd"
}
}
Preview published to npm registry — try new features instantly! |
…aw fetch Replace the bare fetch example with a compact ToolLoopAgent — a background action triggered on a record, with tools that carry input schemas and a finish tool — matching the SDK's house example style (no Deno/npm: scaffolding). Keeps the "point any OpenAI-compatible client at baseURL/token" note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
DolevEpshtein
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
base44.aiGateway.connection()built the domain-routed gateway URL:baseURL: `${serverUrl}/api/ai/openai/v1`That endpoint resolves the app from the request Host. But in the browser the SDK targets the shared platform host (
serverUrldefaults tohttps://base44.app), so when a backend function calls the gateway, the injectedBase44-Api-Urlis that shared host — the call lands on a host that resolves to no app and 404s ("App not found for this domain").