Azure-sdk-for-js: CustomDomains.enableCustomHttps returns error: The resource format is invalid

Created on 30 Sep 2020  路  7Comments  路  Source: Azure/azure-sdk-for-js

  • Package Name: @azure/arm-cdn
  • Package Version: 5.0.0
  • Operating system: macOS
  • [x] nodejs

    • version: v12.16.3

Describe the bug
Following the pulumi example I get an error as customDomains.enableCustomHttps gets called. It's not really related to pulumi I guess, as internally the @azure/arm-cdn package is used.

 error: The resource format is invalid.

To Reproduce
Steps to reproduce the behavior:

  1. Follow this tutorial https://www.pulumi.com/docs/tutorials/azure/azure-ts-dynamicresource/

Expected behavior
https is either en-/disabled depending on the call

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Kind of the same error was described in the azure-cli project and fixed recently. Might it be related?

Mgmt Network - CDN customer-reported needs-author-feedback no-recent-activity question

All 7 comments

Thanks for reporting this. I will take a look at this and get back to you ASAP.

@devployment I am able to repro this issue with pure JS SDK now.

The reason is that the options parameter to enableCustomHttps can't be optional as the customDomainHttpsParameters property is required. So both the options and customDomainHttpsParameters need to be made required, or have a default value.

To sort out the Pulumi resource, you can use

await cdnClient.customDomains.enableCustomHttps(
    inputs.resourceGroupName,
    inputs.profileName,
    inputs.endpointName,
    this.name,
    {
        customDomainHttpsParameters: {
            certificateSource: "Cdn",
            certificateSourceParameters: {
                certificateType: "Dedicated"
            },
            protocolType: "ServerNameIndication"
        }
    });

@ChrisKlug I had a try of your suggestion. It works. I also see your PR since the JS SDK code is generated from azure-rest-api-specs let me see how to leverage that.

The new cdn SDK is released now https://www.npmjs.com/package/@azure/arm-cdn/v/5.1.0. It should be able to resolve your issue @devployment @ChrisKlug

Thank you! That is great news!

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

Was this page helpful?
0 / 5 - 0 ratings