I needed to split the issue into 2, cause of the 32000 signs limit
Describe the issue/error/question
Trying to make Custom HTTP POST request to add Line Items to the opportunity. It worked for long time, stopped to work today.
I tried to add Salesforce node before custom HTTP request, but it failed.
Tried to change settings in Salesforce, like session timeout, refresh token timeout etc. - but still not working.
What is the error message (if any)?
ERROR: UNKNOWN ERROR - check the detailed error for more information
Session expired or invalid
status 401
Information on your n8n setup
-
n8n version: 0.197.1
-
Database you’re using (default: SQLite): not sure
-
Running n8n with the execution process [own(default), main]: not sure
-
Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker
Hi @Aleksander, welcome to the community!
I am very sorry to hear you’re having trouble. I just tried using the HTTP Request node to make a request using Salesforce credentials but didn’t run into any trouble here.
Can you confirm whether this happens for every single request you’re sending to Salesforce or just for a specific one from your workflow (and if so, which of the HTTP Request nodes would have the problem)?
Also, could you try upgrading to n8n version 0.198 and confirm if the issue persists following the upgrade? This version contains a fix for the HTTP Request node, sorting out some problems with OAuth credentials.
It might also be worth giving the Reconnect option in your Salesforce credentials a go:
Thanks for the quick reply and your help!
-
Sorry I forgot to mention which node - only the last HTTP requests (Add item…). What’s interesting - I have Custom HTTP request before (Add contact to opportunity) which works correctly.
-
“Reconnect” for Salesforce credentials didn’t help
-
Upgrading - unfortunately I’m not the server administrator, so I’m sending request to him
I also tried updating SF API to v56, disabling previous HTTP Request (thought it might be the issue) etc. but nothing helped.
I’m asking the admin to update n8n, let’s see if it works.
Tbh, the upgrade will probably not change a thing - the respective pull request doesn’t touch Salesforce, it was just something that came to my mind with regards to the changelog.
That’s really odd though. I’ll set some time aside tomorrow to give this a closer look and see if I can create line items in my account.
Hi @Aleksander, thanks so much for your patience here. I gave this a go on my end using the simplified workflow below:
I updated a bunch of IDs to match stuff I have in my own account, replaced the API URL to match my account and removed the custom field Period_Months__c
from the HTTP Request, but otherwise used your logic. Unfortunately, the request is working as expected, meaning so far, I wasn’t able to reproduce your problem
I also tried adding an artificial Wait time of 25 minutes to my test workflow which should let the access token expire:
However, the request still completed as it should (after the wait time). So, I wonder if this request just fails for some rather than all items for you and whether the response might just be misleading. Are you passing on more than 1 item to the HTTP Request node? Is the request working when ran on its own using hard-coded IDs and values rather than expressions?
Does the behaviour change if you create fresh Salesforce credentials in n8n?
Unfortunately, no
I tested :
- Creating new credentials
- Having two different credentials, one for whole flow, second only for the buggy last HTTP requests
- Having only one credential for flow
- Passing only one item to HTTP request
- Passing only one item without “Period_Months__c”
- Playing with checkboxes in Salesforce App, like “Enable Client Credentials Flow”, “Require Secret for Web Server Flow” etc.
Nothing helped
Hey @Aleksander,
That is a bit strange I would have expected new credentials to work. When you add the credential into n8n are you using production or sandbox?
Is it failing instantly when you use the HTTP Request node or does it work for a bit after adding new credentials? Are you also using the correct URL and do the scopes match up?
Hello @Jon, thanks for the reply.
- I’m using only the sandbox mode and I have no access to production at this time.
- After credentials update, nothing changes. It doesn’t work at all. Node executes for like a second and returns the error.
- Before, I added all possible scopes to the app but it didn’t help as well.
- URL should be correct, it worked for few months.
I also just noticed that the previous HTTP Call didn’t work, it just had the “Continue on fail” checked.
I created new workflow, which has only some GET request to SF. Same issue.
So in summary - for me, HTTP Request node doesn’t work with the Salesforce at all
I was having this same issue @Aleksander when trying to use the HTTP node for Salesforce. I found out my mistake was with the URL. I was using [domain].lightning.force.com when the correct domain was [domain].my.salesforce.com
Before figuring that out, I also explored this, which didn’t make any difference. I hope this helps you or someone else.