This topic was automatically generated from Slack. You can find the original thread here.
hey guys, getting an issue using salesforce with the pipedream proxy with relative urls. More details in thread
This topic was automatically generated from Slack. You can find the original thread here.
hey guys, getting an issue using salesforce with the pipedream proxy with relative urls. More details in thread
this is the code:
import ** as pd from "@pipedream/sdk";
export async function execute(input) {
const client = pd.createBackendClient({
environment: process.env.PIPEDREAM_ENVIRONMENT,
projectId: process.env.PIPEDREAM_PROJECT_ID,
credentials: {
clientId: process.env.PIPEDREAM_CLIENT_ID,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET,
},
});
/** ------------------------------------------------------------------ **
** 1. Short-circuit if nothing to create **
** ------------------------------------------------------------------ **/
const contacts = input.ctx.ai_generate_structured.organized_data ?? [];
if (!Array.isArray(contacts) || contacts.length === 0) {
console.log("No contacts to create from previous step.");
return { output: { success: true, message: "No contacts to create." } };
}
/** ------------------------------------------------------------------ **
** 2. Build the composite-sobjects payload **
** ------------------------------------------------------------------ **/
const body = {
allOrNone: false,
records: contacts.map(c => ({
attributes: { type: "Contact" },
...c,
})),
};
/** ------------------------------------------------------------------ **
** 3. Fire the request through the proxy using a ****relative**** path **
** ------------------------------------------------------------------ */
const response = await client.makeProxyRequest(
{
// identifies which connected account to use
searchParams: {
account_id: input.account_id,
external_user_id: input.external_user_id,
},
},
{
url: "/services/data/v59.0/composite/sobjects",
options: {
method: "POST",
headers: { "Content-Type": "application/json" },
body,
},
}
);
return { output: response };
}
this is the error i’m getting:
{
"success": false,
"error": "Error: HTTP error! status: 400, body: [{\"errorCode\":\"URL_NOT_RESET\",\"message\":\"Destination URL not reset. The URL returned from login must be set\"}]\n at P.makeRequest (file:///root/.cache/riza-runtimes/01JY31BFEFPE0AF1WTV0GNEZR3/vendor/esm.sh//@pipedream/sdk@1.6.9/denonext/sdk.mjs:3:2379)\n at eventLoopTick (ext:core/01_core.js:178:7)\n at async execute (file:///main.js:51:20)\n at async main (file:///main.js:91:34)\n at async file:///main.js:112:1",
"nodeId": "3bea1cff-1223-4aab-9ae8-1af44f4c494a"
Hm that seems like it’s coming from Salesforce, but I wonder why. Can you share a projectId?
This is using pipedream connect, just running the code in a sandbox. The connection I did using the production option in the salesforce connection
this is the project id for the project i’m using for connect proj_6xsgn0V
I’m not positive but I do see random articles and posts for Salesforce w/ that specific error message online
Is it just that endpoint specifically?
i have not tried any other endpoints. I’ll take a look and I’ll lyk if other endpoints do not work. Thanks for taking a look