Keep getting a "Host: https. is not in the cert's altnames: DNS:myshopify.com" error

dankeller101
New Member
1 0 0

Hi all!

I'm using a Node.js server to make requests to Shopify.  Specifically, I'm using the advertised third party library for node (https://github.com/MONEI/Shopify-api-node)

 

After running through the OAuth flow, I have an "initialize Shopify function".  It appears as below:

 

const initializeShopifyIntegration = async (
    database: Database,
    shopName: string,
    accessToken: string,
    brandId: number,
): Promise<void> => {
    const shopify = new ShopifyAPI(shopName, accessToken);
    // init webhooks
    await shopify.createWebhook(SHOPIFY_UNINSTALL_TOPIC, brandId);
    await shopify.createWebhook(SHOPIFY_CREATE_ORDER_TOPIC, brandId);
    await shopify.createWebhook(SHOPIFY_ORDER_CANCEL_TOPIC, brandId);
    await shopify.createWebhook(SHOPIFY_ORDER_DELETE_TOPIC, brandId);
    await shopify.createWebhook(SHOPIFY_REFUNDS_TOPIC, brandId);
    await shopify.pullAndIngestOrders(database, brandId);
    await shopify.addScriptSnippet();
    // const couponCodeHandler = new CouponCodeHandler(database);
    // await couponCodeHandler.setUpOrChangeCouponCodeForBrand(brandId, null);
    // await couponCodeHandler.createCouponCodesForAllExistingAffiliates(brandId);
    Logger.debug('successfully run init');
    return;
};

 

 
This function creates our webhooks, pulls and ingests orders, and creates coupon codes for brand advocates.
If you notice, the Coupon Code Handler is commented out.  This is because it is currently broken.
 
Whenever we run the function to create coupon codes, we are getting the below error when we run the Create Price Rule post request.
Hostname/IP does not match certificate's altnames:  Host: https. is not in the cert's altnames: DNS:myshopify.com" error

I've seen this error before when I have incorrectly used the API (e.g. made an API call after our app was uninstalled from our development store.  However, I can't figure out what the issue is here.
 
Here is the current call to the price rule API:

 

    async createPriceRule(amount: number): Promise<Shopify.IPriceRule> {
        const currentDate = new Date();
        return await this.shopifyWrapper.priceRule.create({
            value: amount,
            value_type: 'percentage',
            usage_limit: null,
            title: PRICE_RULE_NAME,
            target_type: 'line_item',
            target_selection: 'all',
            starts_at: currentDate.toString(),
            once_per_customer: false,
            customer_selection: 'all',
            allocation_method: 'across',
        });
    }

 

 
What are we doing wrong?  Are there parameters that are incorrect in the create call?  Is this an issue with the Shopify API wrapper we're using?
 
Does anyone have suggestions on how I can debug this?
 
0 Likes