azure-apim-extension icon indicating copy to clipboard operation
azure-apim-extension copied to clipboard

unexpected token

Open Emmanuel35 opened this issue 3 years ago • 0 comments

I use a pipeline declaration to modify an operation

- task: apimoperationpolicies@5
        displayName: 'listGammes'
        inputs:
          ConnectedServiceNameARM: 'xxx'
          ResourceGroupName: '$(APIM.resourceGroupName)'
          ApiPortalName: '$(APIM.portalName)'
          ApiName: '$(ApiKey)$(ApiVersion)'
          OperationName: 'listGammes'
          CurrentRevision: true
          MicrosoftApiManagementAPIVersion: '$(MicrosoftApiVersion)'
          TemplateSelector: 'Artifact'
          policyArtifact: '$(System.DefaultWorkingDirectory)/$(ApiKey)/policies/listGammes.xml'

My policies file, listGammes.xml, contains:

<set-variable name="code"
			value="@(
				context.Request.Url.Query.GetValueOrDefault("code", "")
			)"/>

Deploiment block with an error:

...
<set-variable name=\"code\"
			value=\"@(
				context.Request.Url.Query.GetValueOrDefault(\"code\", \"\")
			)\"/>

...
@{code=ValidationError; target=representation; message='code' is an unexpected token. Expecting white space. Line 24, position 50.}
##[error]The remote server returned an error: (400) Bad Request.

So, I have checked and verify my policies. It is accepted with a manual deployment.

Emmanuel35 avatar Sep 29 '21 16:09 Emmanuel35