Debugging 500 Error on Salesforce Trigger?

can you please follow these steps and inform me the result?

  1. Create a new workflow
  2. Add a new action step
  3. Search for Salesforce and select Use any Salesforce API in Node.js
  4. Substitute to all the code below:
  5. Test
import salesforceWebhooks from "salesforce-webhooks";
const { SalesforceClient } = salesforceWebhooks;

export default defineComponent({
  props: {
    salesforce_rest_api: {
      type: "app",
      app: "salesforce_rest_api",
    }
  },
  methods: {
    _apiVersion() {
      return "50.0";
    },
    _authToken() {
      return this.salesforce_rest_api.$auth.oauth_access_token;
    },
    _instance() {
      return this.salesforce_rest_api.$auth.yourinstance;
    },
    _instanceUrl() {
      return this.salesforce_rest_api.$auth.instance_url;
    },
    _subdomain() {
      return (
        this._instance() ||
        this._instanceUrl()
          .replace("https://", "")
          .replace(".[salesforce.com](http://salesforce.com)", "")
      );
    },
    _getSalesforceClient() {
      const clientOpts = {
        apiVersion: this._apiVersion(),
        authToken: this._authToken(),
        instance: this._subdomain(),
      };
      return new SalesforceClient(clientOpts);
    },
  },
  async run({steps, $}) {
    const client = this._getSalesforceClient();
    const webhookOpts = {
      endpointUrl: "https://www.unexistent-endpoint-10845209472.com",
      sObjectType: "User",
      event: "new",
      secretToken: "secret",
    };
    return client.createWebhook(webhookOpts);
  },
})

yeah gimme a sec

Heh that’s weird. Can you go to the workflow settings and max the timeout and save?

sure

trying again

Hah ok I think I figured it out (famous last words), let’s try this:
Can you console.log(**this**._instanceUrl()) in your code?

I just need to know if it’s https://*.[salesforce.com](http://salesforce.com) or not

it worked a second time

I didn’t put in the console log

you still want me to add it?

oh whoops

that’s the wrong flow

let me put in console log

here is the error with console log

OK thanks,
Are you sure you have the correct account logged in?
It’s showing that the instance is https://welcome.my.salesforce.com

yeah that’s correct

that’s our salesforce instance URL