Skip to content

The open alternative to Salesforce, designed for AI.

Fix captcha validation failing due to missing URL in secure axios adapter (#17807)

Félix Malfaitc18726d712dd
diff --git a/packages/twenty-server/src/engine/core-modules/tool/utils/get-secure-axios-adapter.util.ts b/packages/twenty-server/src/engine/core-modules/tool/utils/get-secure-axios-adapter.util.ts
index fff182d85ac..085c5629140 100644
--- a/packages/twenty-server/src/engine/core-modules/tool/utils/get-secure-axios-adapter.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/tool/utils/get-secure-axios-adapter.util.ts
@@ -23,11 +23,21 @@ export const getSecureAxiosAdapter = (
const { dnsLookup, httpAdapter } = dependencies;
return async (config: InternalAxiosRequestConfig) => {
- if (!config.url) {
+ // Resolve full URL by combining baseURL and url, matching what the
+ // default axios HTTP adapter does internally. Without this, requests
+ // that rely on baseURL (e.g. captcha drivers) would fail the check
+ // below because config.url can be an empty string.
+ const resolvedUrl = config.url
+ ? config.baseURL
+ ? new URL(config.url, config.baseURL).toString()
+ : config.url
+ : config.baseURL;
+
+ if (!resolvedUrl) {
throw new Error('URL is required');
}
- const url = new URL(config.url);
+ const url = new URL(resolvedUrl);
if (!['http:', 'https:'].includes(url.protocol)) {
throw new Error('URL should use http/https protocol');