I’m using this.helpers.httpRequest(options); for doing some http request and have a use-case where I need to skip ssl certification validation.
For that I have enable skipSslCertificateValidation as true.
But it’s not working.
Example -
const auth_response = await https_request_helper({
method: 'POST',
url: url,
body: cred,
headers: {
'Content-Type': 'application/json'
},
returnFullResponse: true,
skipSslCertificateValidation: true
})
const https_request_helper = async (options) => {
try {
const response_data = await this.helpers.httpRequest(options);
return response_data
} catch (error) {
throw new custom_error(error.response.data.error.message);
}
}
n8n
September 28, 2024, 3:59pm
2
It looks like your topic is missing some important information. Could you provide the following if applicable.
n8n version:
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main):
Running n8n via (Docker, npm, n8n cloud, desktop app):
Operating system:
Jon
September 29, 2024, 11:31am
3
Hey @Ankit_Kumar_Giri
Are you passing the options correctly to the httpRequest function?
Yes @Jon ,
I have provided the sample code in description.
Below is the option, I’m passing. Please let me known if anything is wrong here.
{
method: 'POST',
url: url,
body: cred,
headers: {
'Content-Type': 'application/json'
},
returnFullResponse: true,
skipSslCertificateValidation: true
}
Jon
September 30, 2024, 8:42am
5
Hey @Ankit_Kumar_Giri ,
Have you tried outputting the options to make sure it is being set correcly?
I would also try and simplify it and just do the below and see if that works for you which is working in some test code I am using.
const options : IHttpRequestOptions {
method: 'POST',
url: url,
body: cred,
json: true,
returnFullResponse: true,
skipSslCertificateValidation: true
};
try {
return = await this.helpers.httpRequest.call(this, options);
} catch (error) {
throw new custom_error(error.response.data.error.message);
}
@Jon Yes I have checked the logs for options, and it’s correct. I’ve attached a file for reference.
The sample code you have provided is in TypeScript, if I’m guessing right (Although I have some doubt with the syntax of defining IHttpRequestOptions.)
I’m using JS for code and in JS, using IHttpRequestOptions annotation is not valid.
Please let me known if I’m wrong here.