failed: TLS peer's certificate is not trusted; reason = unable to get local issuer certificate

getting this error while trying to scrape my college website ( they kinda allowed us to do so ) and hosting it on cloudflare workers
import axios from "axios";
import https from "https";

const agent = new https.Agent({ rejectUnauthorized: false });

const client = axios.create({
baseURL: "xxxx",
headers: {
"User-Agent": "Mozilla/5.0 ...",
Accept: "text/html,application/xhtml+xml",
},
httpsAgent: agent,
withCredentials: true,
});
import axios from "axios";
import https from "https";

const agent = new https.Agent({ rejectUnauthorized: false });

const client = axios.create({
baseURL: "xxxx",
headers: {
"User-Agent": "Mozilla/5.0 ...",
Accept: "text/html,application/xhtml+xml",
},
httpsAgent: agent,
withCredentials: true,
});
this is what is creating the error presumably because I created a normal api call not involving the client and it worked, I am using Nextjs and serverless functions and trying to host on cloudflare workers, is there any way around this because the college website has certificate issues, thats why I am using rejectUnauthorized: false
1 Reply
Arya
AryaOP3w ago
Anyone?

Did you find this page helpful?