fix(n8n): set credential domains access to all
This commit is contained in:
parent
f700b40995
commit
6dbf431cf7
3 changed files with 24 additions and 25 deletions
|
|
@ -54,8 +54,8 @@ async function getOrCreateCredential(name: string, type: string, data: any) {
|
||||||
const credsList = await n8nRequest("/api/v1/credentials");
|
const credsList = await n8nRequest("/api/v1/credentials");
|
||||||
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
||||||
if (existingCred) {
|
if (existingCred) {
|
||||||
console.log(`Reusing existing credential: ${name} (ID: ${existingCred.id})...`);
|
console.log(`Deleting existing credential to recreate: ${name} (ID: ${existingCred.id})...`);
|
||||||
return existingCred.id;
|
await n8nRequest(`/api/v1/credentials/${existingCred.id}`, "DELETE");
|
||||||
}
|
}
|
||||||
|
|
||||||
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
||||||
|
|
@ -98,7 +98,7 @@ async function main() {
|
||||||
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase", "supabaseApi", {
|
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase", "supabaseApi", {
|
||||||
host: SUPABASE_URL,
|
host: SUPABASE_URL,
|
||||||
serviceRole: SUPABASE_SECRET_KEY,
|
serviceRole: SUPABASE_SECRET_KEY,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4. Fetch Candidate Evaluation Workflow ID
|
// 4. Fetch Candidate Evaluation Workflow ID
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@ async function getOrCreateCredential(name: string, type: string, data: any) {
|
||||||
const credsList = await n8nRequest("/api/v1/credentials");
|
const credsList = await n8nRequest("/api/v1/credentials");
|
||||||
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
||||||
if (existingCred) {
|
if (existingCred) {
|
||||||
console.log(`Reusing existing credential: ${name} (ID: ${existingCred.id})...`);
|
console.log(`Deleting existing credential to recreate: ${name} (ID: ${existingCred.id})...`);
|
||||||
return existingCred.id;
|
await n8nRequest(`/api/v1/credentials/${existingCred.id}`, "DELETE");
|
||||||
}
|
}
|
||||||
|
|
||||||
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
||||||
|
|
@ -85,7 +85,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialType: "deepSeekApi",
|
credentialType: "deepSeekApi",
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "deepseek-chat",
|
model: modelName || "deepseek-chat",
|
||||||
|
|
@ -99,7 +99,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
header: false,
|
header: false,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "gpt-4o-mini",
|
model: modelName || "gpt-4o-mini",
|
||||||
|
|
@ -113,7 +113,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
host: "https://generativelanguage.googleapis.com",
|
host: "https://generativelanguage.googleapis.com",
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "gemini-1.5-flash",
|
model: modelName || "gemini-1.5-flash",
|
||||||
|
|
@ -126,7 +126,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialType: "anthropicApi",
|
credentialType: "anthropicApi",
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "claude-3-5-sonnet-latest",
|
model: modelName || "claude-3-5-sonnet-latest",
|
||||||
|
|
@ -253,7 +253,7 @@ async function main() {
|
||||||
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase_V3", "supabaseApi", {
|
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase_V3", "supabaseApi", {
|
||||||
host: SUPABASE_URL,
|
host: SUPABASE_URL,
|
||||||
serviceRole: SUPABASE_SECRET_KEY,
|
serviceRole: SUPABASE_SECRET_KEY,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
const primaryConfig = getProviderConfig(primaryProviderChoice, primaryApiKey, primaryModelName);
|
const primaryConfig = getProviderConfig(primaryProviderChoice, primaryApiKey, primaryModelName);
|
||||||
|
|
|
||||||
|
|
@ -75,17 +75,16 @@ async function getOrCreateCredential(name: string, type: string, data: any) {
|
||||||
const credsList = await n8nRequest("/api/v1/credentials");
|
const credsList = await n8nRequest("/api/v1/credentials");
|
||||||
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
const existingCred = credsList.data.find((c: any) => c.name === name && c.type === type);
|
||||||
if (existingCred) {
|
if (existingCred) {
|
||||||
console.log(`Reusing existing credential: ${name} (ID: ${existingCred.id})`);
|
console.log(`Deleting existing credential to recreate: ${name} (ID: ${existingCred.id})...`);
|
||||||
return existingCred.id;
|
await n8nRequest(`/api/v1/credentials/${existingCred.id}`, "DELETE");
|
||||||
} else {
|
|
||||||
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
|
||||||
name,
|
|
||||||
type,
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
console.log(`Created new credential: ${name} (ID: ${newCred.id})`);
|
|
||||||
return newCred.id;
|
|
||||||
}
|
}
|
||||||
|
const newCred = await n8nRequest("/api/v1/credentials", "POST", {
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
console.log(`Created new credential: ${name} (ID: ${newCred.id})`);
|
||||||
|
return newCred.id;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(`Error setting up credential ${name}:`, err.message);
|
console.error(`Error setting up credential ${name}:`, err.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
@ -108,7 +107,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialType: "deepSeekApi",
|
credentialType: "deepSeekApi",
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "deepseek-chat",
|
model: modelName || "deepseek-chat",
|
||||||
|
|
@ -122,7 +121,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
header: false,
|
header: false,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "gpt-4o-mini",
|
model: modelName || "gpt-4o-mini",
|
||||||
|
|
@ -136,7 +135,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
host: "https://generativelanguage.googleapis.com",
|
host: "https://generativelanguage.googleapis.com",
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "gemini-1.5-flash",
|
model: modelName || "gemini-1.5-flash",
|
||||||
|
|
@ -149,7 +148,7 @@ function getProviderConfig(provider: string, apiKey: string, modelName: string):
|
||||||
credentialType: "anthropicApi",
|
credentialType: "anthropicApi",
|
||||||
credentialData: {
|
credentialData: {
|
||||||
apiKey,
|
apiKey,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
},
|
},
|
||||||
nodeParameters: {
|
nodeParameters: {
|
||||||
model: modelName || "claude-3-5-sonnet-latest",
|
model: modelName || "claude-3-5-sonnet-latest",
|
||||||
|
|
@ -240,7 +239,7 @@ async function main() {
|
||||||
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase", "supabaseApi", {
|
const supabaseCredId = await getOrCreateCredential("Semillero2_Supabase", "supabaseApi", {
|
||||||
host: SUPABASE_URL,
|
host: SUPABASE_URL,
|
||||||
serviceRole: SUPABASE_SECRET_KEY,
|
serviceRole: SUPABASE_SECRET_KEY,
|
||||||
allowedHttpRequestDomains: "none",
|
allowedHttpRequestDomains: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3. Manage Primary Model Credentials
|
// 3. Manage Primary Model Credentials
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue