fix(engine): fix broken URL resolution in Ollama and MLX engines#547
Merged
di-sukharev merged 1 commit intodi-sukharev:masterfrom Apr 3, 2026
Merged
Conversation
Both OllamaEngine and MLXEngine had two bugs in URL construction:
1. `axios.create({url: ...})` was used instead of `baseURL`, but `url`
in axios config sets a default request URL - not a base prefix. This
caused the URL to be ignored when `.post()` was called with a path.
2. `this.client.getUri(this.config)` was used to resolve the POST URL,
but passing the engine config (which contains non-axios properties
like `apiKey`, `model`, etc.) produced malformed URLs. When
`apiKey` is null (the default for Ollama), the URL resolved to
`http://localhost:11434/null`, returning HTTP 405.
Fix: construct the full endpoint URL once in the constructor and pass
it directly to `axios.post()`, matching how FlowiseEngine already works.
Co-Authored-By: Claude <noreply@anthropic.com>
Owner
|
thank you @keith666666 |
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.
Summary
Both
OllamaEngineandMLXEngineproduce malformed URLs when making API requests, causing HTTP 405 errors.Root cause — two bugs in URL construction:
axios.create({ url: ... })was used instead ofbaseURL. In axios,urlsets a default request URL, not a base prefix — so it gets ignored when.post(path, data)is called separately.this.client.getUri(this.config)was used to resolve the POST URL, but the engine config contains non-axios properties (apiKey,model,maxTokensOutput, etc.) that pollute URL resolution. WhenapiKeyisnull(the default for Ollama), the URL resolves tohttp://localhost:11434/null, which returns HTTP 405.Fix: Construct the full endpoint URL once in the constructor and pass it directly to
axios.post()— matching howFlowiseEnginealready works.Before (broken)
After (fixed)
Test plan
npm test— all 37 unit tests passnpm run build— builds successfullyqwen3.5:2b) — commit message generated successfully