Repository navigation
Add missing https:// to setup addresses and offer Odoo JSON-RPC switch - #1453
Merged
Conversation
An address typed without a scheme (acme.odoo.com) was refused by the field pattern with a message that never named the missing https://. Address fields whose pattern wants a scheme now get https:// added before the check, on the setup page, the chat install, the import and the variable editor. A value still refused names the smallest change the pattern accepts (add https://, cut /web after the host, drop a trailing slash). When the Odoo JSON-2 check finds a version below 19, the verify result carries switchTo with the JSON-RPC adapter and the non-secret values to carry over. The setup page turns it into a Switch button that opens the JSON-RPC setup prefilled with address and database, keeps from=, and deletes the left-behind draft once the new connector is saved, if that draft is still not ready.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Two dead ends found in an end-to-end run of the guided setup page (
/connectors/setup/<slug>?connector=<id>&from=claude):amcp-e2e-test.odoo.cominto "Odoo address" showed "Only the address up to the host, e.g. https://mycompany.odoo.com (…)" and blocked the save. The message never said that thehttps://was missing. The backend already addedhttps://to a variable that starts the base URL. The client checked the pattern first and refused the value before the backend saw it. Address variables outside the base URL (Zoho accounts server, Amazon Ads / DocuSign auth URLs, …) were never normalised anywhere.odoodraft in the workspace.Changes
adapters/address-fix.ts:withMissingSchemeaddshttps://to an address field (kindaddressor an address-like name, never a secret) only when the field'spatternrefuses the value as typed and accepts it withhttps://. Applied wherever the pattern is enforced: install/verify (prepareConnectorvianormalizeAdapterEnvValues(adapter, …)), the variable editor (ConnectorsController.normalizeVariables), the chat install (ConnectorSetupService.install) and the setup page (on blur, invalidate()and in the values sent). Values that are wrong in another way are still refused (a path after the host,www.on odoo.com, a single-label host such aserp:8069, where http vs https cannot be guessed). A field whose pattern wants a bare host (Exercise.com) keeps it. This covers every adapter whose address pattern requireshttps://orhttps?://(WooCommerce, PrestaShop, Xentral, GitLab, n8n, Zoho, …), with no list of adapters.addressFixfinds the smallest change the pattern accepts: add https://, http→https, drop a trailing/, dropwww., cut what follows the host. Fixes that change less are preferred. The backend check, the chat install and the setup page now say e.g. "Remove /web after the host: https://erp.acme.de." or "Add https:// in front and remove /odoo/discuss after the host: https://acme.odoo.com". If no such change exists, the adapter's ownpatternMessageis shown, as before. Fix phrases are translated (en/de/it). The fixed value is shown only for non-secret address fields.switchToin the verify result. When the verify suggests another adapter (Odoo < 19 →odoo-jsonrpc), the result now also carriesswitchTo: { slug, name, prefill }.prefillcomes from the newcarriedSetupValues: only variables both adapters declare under the same name that neither treats as a secret or credential. Both Odoo adapters useODOO_URLandODOO_DB, so those two carry over.ODOO_API_KEYnever does, andODOO_UIDexists only on JSON-RPC.suggest/suggestNamestay for existing consumers./connectors/setup/odoo-jsonrpc?prefill.ODOO_URL=…&prefill.ODOO_DB=…&from=<from>&replaces=<connector id>. No key or secret goes into the URL: the backend only offers non-secret values, and the target page never reads a credential from a link (existing rule). The old plain link is shown only when there is noswitchTo.replaces=). After the JSON-RPC connector is saved, the page loads the replaced connector through the existingGET /api/connectors/:idand deletes it throughDELETE /api/connectors/:id. It deletes only if the connector exists, is notready, and comes from a different catalog adapter. Both endpoints are org-scoped and write-checked as before. A ready connector (e.g. one saved with "Save anyway") or a failure keeps the old connector, which stays visible under Connectors. The prompt allowed keeping the draft if deletion got risky; I kept the deletion, with these guards.Not changed: the verify still offers the switch when Odoo's version cannot be read at all (the adapter's
verifyHintssuggestion, as before).switchTofollowssuggestin that case too. No adapter JSON, Prisma schema oree/code is touched.Cloud and self-hosted
Both deployments behave the same: the code has no
isCloud()branch. On self-hosted setups the scheme fix does not change single-label internal hosts (odoo:8069,localhost). Those must still be typed withhttp://orhttps://, as before. An internal dotted host typed without a scheme getshttps://, which the base-URL normaliser already did for base-URL variables. The draft deletion uses the normal connector API with the signed-in user's rights. A user who may not delete connectors gets an error that the page ignores, so the draft is kept.Type
Testing
Commands run (all through the shared lock script, Jest with
--maxWorkers=4):npm ci --no-audit --no-fund --ignore-scriptspackages/backendDATABASE_URL=postgresql://x:y@localhost:5433/z npx prisma generatepackages/backendnpm run lint--fixchanged no filespackages/backendnpx tsc --noEmit -p tsconfig.jsonpackages/backendnpx jest --maxWorkers=4(full suite)node scripts/validate-adapters.mjs --warnpackages/frontendnpm run lintpackages/frontendnpx tsc --noEmit -p tsconfig.jsonpackages/frontendCI=1 npx playwright test(full suite, chromium already installed)The new e2e spec
tests/e2e/connector-setup-address.spec.tscovers four cases, with API calls mocked:amcp-e2e-test.odoo.comturns intohttps://amcp-e2e-test.odoo.comand is sent that way.from=claude,replaces, no key. The JSON-RPC page opens prefilled with an empty key field, and saving deletes theneeds_inputdraft.The first full backend run had one failure:
connectors.controller.spec.tsstill expected the old generic Odoo/webmessage. I updated that assertion to the new fix text, and the run above is the rerun.Checklist
replaces=) and the code comments are updated; no user docs describe these messages.npm test)Related Issues
None filed. Found in an end-to-end test of the chat setup link on Cloud.