hasura / hasura/graphql-engine
escapeUri in action request url template is no longer executed causing an Invalid URL TransformationError
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
2.15.2
### Environment
AWS EKS
### What is the current behaviour?
Actions connecting to REST endpoint that require kriti escapeUri transformations no longer work
The following Request URL Template worked in 2.13.0:
/{{ escapeUri $body.input.dictionary }}/entities/{{ escapeUri $body.input.entity }}
This now yields an Invalid URL TransformationError at runtime, the transform is correctly applied in the console preview.
":"[{\"error_code\":\"TransformationError\",\"message\":\"Invalid URL: https://some-domain/api/v1/schemas/dictionaries/Reference Data/entities\"}]","level":"error","timestamp":"2022-12-15T08:48:07.453+0000","type":"unstructured"}
{"detail":{"http_info":{"content_encoding":null,"http_version":"HTTP/1.1","ip":"170.207.32.4","method":"POST","status":200,"url":"/v1/graphql"},"operation":{"error":{"code":"unexpected","error":"Request Transformation Failed","internal":[{"error_code":"TransformationError","message":"Invalid URL: https://conductor-design-service/api/v1/schemas/dictionaries/Reference Data/entities"}],"path":"$"},"query":{"operationName":"MyQuery","query":"query MyQuery($dictionary: String!) {\n schemaEntities(dictionary: $dictionary) {\n name\n __typename\n }\n}\n","variables":{"dictionary":"Reference Data"}}
### What is the expected behaviour?
The url should have been encoded as https://some-domain/api/v1/schemas/dictionaries/Reference%20%Data/entities
### How to reproduce the issue?
1. Create an action connecting to a REST uri with a base url template that takes a parameter from the body e.g. /{{escapeUri $body.input.dictionary}}/entities/{{escapeUri $body.input.entity}}
2. Query the action sending a value with a space for input.entity e.g. "entity name"
3. The escapeUri fails to transform the url at runtime however it is transformed in the action configuration console
### Screenshots or Screencast

### Please provide any traces or logs that could help here.
":"[{\"error_code\":\"TransformationError\",\"message\":\"Invalid URL: https://some-domain/api/v1/schemas/dictionaries/Reference Data/entities\"}]","level":"error","timestamp":"2022-12-15T08:48:07.453+0000","type":"unstructured"}
{"detail":{"http_info":{"content_encoding":null,"http_version":"HTTP/1.1","ip":"170.207.32.4","method":"POST","status":200,"url":"/v1/graphql"},"operation":{"error":{"code":"unexpected","error":"Request Transformation Failed","internal":[{"error_code":"TransformationError","message":"Invalid URL: https://conductor-design-service/api/v1/schemas/dictionaries/Reference Data/entities"}],"path":"$"},"query":{"operationName":"MyQuery","query":"query MyQuery($dictionary: String!) {\n schemaEntities(dictionary: $dictionary) {\n name\n __typename\n }\n}\n","variables":{"dictionary":"Reference Data"}}
### Any possible solutions/workarounds you're aware of?
Pre encoding the space does not seem to work
### Keywords searched
escapeUri
TransformationError
Invalid URL
Contributor guide
Research direction
Start from the action Request URL Template runtime transformation and compare it with the console preview, using the reproduction with a space in the input value. Trace why escapeUri is not applied at runtime; done means the generated URL encodes the space and the REST action succeeds without an Invalid URL TransformationError.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100