stephaneey / azure-apim-extension

Full Azure API Management suite and more VSTS extension
MIT License
66 stars 48 forks source link

stephane-eyskens.apim.apimversioned.apimversioned@4 leads to errors #77

Closed iamjyotirmoy closed 4 years ago

iamjyotirmoy commented 4 years ago

Hello, I have a task definition as below:

- task: stephane-eyskens.apim.apimversioned.apimversioned@4
  displayName: 'API Management - Create/Update API '
  inputs:
    ConnectedServiceNameARM: 'Azure DEV/INT Subscription'
    ResourceGroupName: 'rg-org-iot-we-dev-outbound-shared'
    ApiPortalName: 'apim-org-iot-we-dev-outbound-shared'
    OpenAPISpec: v3
    UseProductCreatedByPreviousTask: false
    product1: manage
    swaggerlocation: 'https://web-org-iot-we-dev-manage-api-v1.azurewebsites.net/api-docs/swagger.json'
    targetapi: manage
    scheme: Header
    VersionHeader: 'X-Api-Version'
    pathapi: manage
    MicrosoftApiManagementAPIVersion: '2017-03-01'

The task always leads to the error :

2020-03-15T09:55:46.9744207Z ##[section]Starting: API Management - Create/Update API 
2020-03-15T09:55:46.9857600Z ==============================================================================
2020-03-15T09:55:46.9858029Z Task         : API Management - Create or Update Versioned API
2020-03-15T09:55:46.9858389Z Description  : API Management - Create or Update Versioned API
2020-03-15T09:55:46.9858672Z Version      : 4.1.1
2020-03-15T09:55:46.9859062Z Author       : Stephane Eyskens
2020-03-15T09:55:46.9859351Z Help         : API Management - Create/Update API
2020-03-15T09:55:46.9859677Z ==============================================================================
2020-03-15T09:55:47.8252137Z Preparing API publishing in v3 format json using Azure API 2017-03-01
2020-03-15T09:55:47.9986123Z 
2020-03-15T09:55:48.0029700Z checking whether https://management.azure.com/subscriptions/467d0b3b-6a6a-4c6f-b4ed-03dda940ll3r/resourceGroups/rg-org-iot-we-dev-outbound-shared/providers/Microsoft.ApiManagement/service/apim-org-iot-we-dev-outbound-shared/apis/managev1?api-version=2017-03-01 exists
2020-03-15T09:55:48.7980180Z ##[error]You cannot call a method on a null-valued expression.
2020-03-15T09:55:48.8367847Z ##[section]Finishing: API Management - Create/Update API 

Can you please help on this? I even tried the version 3 task, that led to similar errors. Previous to this I was exposing using the task 'stephane-eyskens.apim.apim.apim@3' and that works fine and the APIs are published on the API management - however all attempts to publish a versioned API leads to errors.

stephaneey commented 4 years ago

Hi,

Did you purposely specify api version 2017-03-01? As of V4, the api should be 2019-01-01 (default value) so try to update this.

Best regards

iamjyotirmoy commented 4 years ago

Thanks for the quick response. I just tried it with API version 2019-01-01, it gives the same error as before. I even tried V3, it leads to the same error.

Best regards

ghost commented 4 years ago

Thanks for the quick response. I just tried it with API version 2019-01-01, it gives the same error as before. I even tried V3, it leads to the same error.

Best regards

I had the same problem, but changing API version fixed it for me... Could you post new logs with changed API version.

stephaneey commented 4 years ago

Also, having this with V3 means that you have an issue with your config. I might as well suspect a lack of permission. V3 hasn't be changed for ages and is pretty stable.

illay1994 commented 4 years ago

Hi @iamjyotirmoy I had same problem when my server certificate was invalid