Self-signed certificate for api.fetch


I have a custom API sitting in a cloud service. I was wondering if forge allows a self-signed certificate.

I read about the options for api.fetch:

but either “https.Agent is not a constructor” error or “failed, reason: self signed certificate” error would be returned.

Is there a way to accept self signed certificates when using the uikit?

If yes, could I get an example as to how it can be done?


Having a self-signed certificate kinda messes the entire “trust” thing out. The only one that knows that the certificate is trustworthy is you… And since Forge doesn’t have a way for us to import private keys - it doesn’t have a way to verify that the certificate is you and not a bad actor.

Why not use letsencrypt to create your certificate?


Have you tried importing Agent from https? As this is standard included in NodeJS, it might actually be available?

import { fetch } from '@forge/api';
import { Agent } from 'https';

const result = await api.fetch("", {
   agent: new Agent({
      rejectUnauthorized: false,
const status = await result.status

I tried @remie’s this method but it returned “— is not a constructor” error. I am going to try letsencrypt to create my certificate.

Thanks for the suggestions