Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az apim import graphql using specification path fails with 'link' is not a valid absolute URI #30465

Open
DSpirit opened this issue Dec 4, 2024 · 2 comments
Labels
API Management az apim Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@DSpirit
Copy link
Contributor

DSpirit commented Dec 4, 2024

Describe the bug

I am trying to import a GraphQL specification from file into API Management.

When running:

az apim api import --path $apiPath --resource-group $resourceGroup `
    --service-name $apiManagementName --api-id $apiId `
    --api-type graphql `
    --specification-format "GraphQL" `
    --service-url "https://contoso.com" `
    --display-name $displayName --specification-format "GraphQL" --specification-path "./schema.gql"

My GraphQL file looks as follows:

schema {
  query: AssetQuery
}

type AssetQuery {
    hello: String
}

I think I found the issue, however can't validate. Please check the linked commit / pull request.

Related command

az apim api import

Errors

using PowerShell v7.4.6, I always run into following issue (no matter the graphql schema):

Exception Details:      (ValidationError) Parsing error(s): 'link' is not a valid absolute URI. Path: link.
        Code: ValidationError
        Message: Parsing error(s): 'link' is not a valid absolute URI. Path: link.
        Target: representation

Issue script & Debug output

az apim api import --path $apiPath --resource-group $resourceGroup --service-name $apiManagementName --api-id $apiId
--api-type graphql --specification-format "GraphQL"
--service-url "https://contoso.com" `
--display-name $displayName --specification-format "GraphQL" --specification-path "./schema.gql"

cli.azure.cli.core.sdk.policies: {"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"representation","message":"Parsing error(s): 'link' is not a valid absolute URI. Path: link."}]}}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 664, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 701, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 334, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/apim/custom.py", line 510, in apim_api_import
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 710, in sdk_no_wait
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/apimanagement/operations/_api_operations.py", line 890, in begin_create_or_update
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/apimanagement/operations/_api_operations.py", line 727, in _create_or_update_initial
azure.core.exceptions.HttpResponseError: (ValidationError) One or more fields contain incorrect values:
Code: ValidationError
Message: One or more fields contain incorrect values:
Exception Details:      (ValidationError) Parsing error(s): 'link' is not a valid absolute URI. Path: link.
        Code: ValidationError
        Message: Parsing error(s): 'link' is not a valid absolute URI. Path: link.
        Target: representation

Expected behavior

The graphql API gets imported properly.

Environment Summary

azure-cli 2.65.0

core 2.65.0
telemetry 1.1.0

Extensions:
containerapp 1.0.0b3
durabletask 1.0.0b1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/home/***/.azure/cliextensions'

Python (Linux) 3.11.8 (main, Sep 25 2024, 11:33:44) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

@DSpirit DSpirit added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Dec 4, 2024
Copy link

Hi @DSpirit,

2.65.0 is not the latest Azure CLI(2.67.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Dec 4, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 4, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. API Management az apim labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management az apim Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants