UDG: Cannot access fields of an input

After updating to 3.2.0, I’m no longer able to access specific fields of an input using a UDG. I’ve added customer as an input argument in my data model

input customer {
  uuid: ID
  first_name: String!
  last_name: String!
  postal_code: String!
}

and in the data source body I have the below

{
  "first_name": "{{.arguments.customer.first_name}}",
  "last_name": "{{.arguments.customer.last_name}}",
  "postal_code": "{{.arguments.customer.postal_code}}",
  "token": "{{.arguments.customer.uuid}}"
}

yet when I run the query and check the log browser, it evaluates to the below

{
  "first_name": "{"uuid":"123","first_name":"john","last_name":"smith","postal_code":"12345"}",
  "last_name": "{"uuid":"123","first_name":"john","last_name":"smith","postal_code":"12345"}",
  "postal_code": "{"uuid":"123","first_name":"john","last_name":"smith","postal_code":"12345"}",
  "token": "{"uuid":"123","first_name":"john","last_name":"smith","postal_code":"12345"}"
}

Hi @Fahad_Ahmed

You may need to check if your API definition is valid in 3.2.0 as it introduced some breaking changes.

For example graphql.type_field_configurations is no longer used and graphql.engine.data_sources is now the replacement for GraphQL APIs.

Kindly follow our migration guide for more information. If you have further issues then please reply on the thread

@Olu I followed the migration guide to get to this point. My API is valid in 3.2.0. I am creating a new API through the dashboard and it does not have graphql.type_field_configurations

{
  "created_at": "2021-07-21T16:15:47Z",
  "api_model": {},
  "api_definition": {
    "api_id": "086b4bcdf5d34d1875337eb7d34f6d77",
    "jwt_issued_at_validation_skew": 0,
    "upstream_certificates": {},
    "use_keyless": true,
    "enable_coprocess_auth": false,
    "base_identity_provided_by": "",
    "custom_middleware": {
      "pre": [],
      "post": [],
      "post_key_auth": [],
      "auth_check": {
        "name": "",
        "path": "",
        "require_session": false,
        "raw_body_only": false
      },
      "response": [],
      "driver": "",
      "id_extractor": {
        "extract_from": "",
        "extract_with": "",
        "extractor_config": {}
      }
    },
    "disable_quota": false,
    "custom_middleware_bundle": "",
    "cache_options": {
      "cache_timeout": 60,
      "enable_cache": true,
      "cache_all_safe_requests": false,
      "cache_response_codes": [],
      "enable_upstream_cache_control": false,
      "cache_control_ttl_header": "",
      "cache_by_headers": []
    },
    "enable_ip_blacklisting": false,
    "tag_headers": [],
    "jwt_scope_to_policy_mapping": {},
    "pinned_public_keys": {},
    "expire_analytics_after": 0,
    "domain": "",
    "openid_options": {
      "providers": [],
      "segregate_by_client": false
    },
    "jwt_policy_field_name": "",
    "enable_proxy_protocol": false,
    "jwt_default_policies": [],
    "active": true,
    "jwt_expires_at_validation_skew": 0,
    "config_data": {},
    "notifications": {
      "shared_secret": "",
      "oauth_on_keychange_url": ""
    },
    "jwt_client_base_field": "",
    "auth": {
      "use_param": false,
      "param_name": "",
      "use_cookie": false,
      "cookie_name": "",
      "auth_header_name": "x-amount-api-authorization",
      "use_certificate": false,
      "validate_signature": false,
      "signature": {
        "algorithm": "",
        "header": "",
        "secret": "",
        "allowed_clock_skew": 0,
        "error_code": 0,
        "error_message": ""
      }
    },
    "check_host_against_uptime_tests": false,
    "auth_provider": {
      "name": "",
      "storage_engine": "",
      "meta": {}
    },
    "blacklisted_ips": [],
    "graphql": {
      "schema": "type CreateAuthorizationControlsResponse {\n  token: String!\n}\n\ntype CreateUserResponse {\n  token: String!\n  createVelocityControls(amount_limit: Float): CreateVelocityControlsResponse\n  createAuthorizationControls(merchant: merchant): CreateAuthorizationControlsResponse\n}\n\ntype CreateVelocityControlsResponse {\n  token: String!\n}\n\ninput customer {\n  uuid: ID\n  first_name: String!\n  last_name: String!\n  postal_code: String!\n}\n\ninput merchant {\n  mid: String\n}\n\ntype Mutation {\n  createUser(customer: customer!): CreateUserResponse\n}\n\ntype Query {\n  default: String\n}\n",
      "enabled": true,
      "engine": {
        "field_configs": [
          {
            "type_name": "CreateUserResponse",
            "field_name": "createVelocityControls",
            "disable_default_mapping": true,
            "path": [
              ""
            ]
          },
          {
            "type_name": "CreateUserResponse",
            "field_name": "createAuthorizationControls",
            "disable_default_mapping": true,
            "path": [
              ""
            ]
          },
          {
            "type_name": "Mutation",
            "field_name": "createUser",
            "disable_default_mapping": true,
            "path": [
              ""
            ]
          }
        ],
        "data_sources": [
          {
            "kind": "REST",
            "name": "create_velocity_controls",
            "internal": true,
            "root_fields": [
              {
                "type": "CreateUserResponse",
                "fields": [
                  "createVelocityControls"
                ]
              }
            ],
            "config": {
              "url": "tyk://d0c6e7a84d9e423e68587a0b540053ce/",
              "method": "POST",
              "body": "{\n  \"usage_limit\": 3,\n  \"velocity_window\": \"LIFETIME\",\n  \"amount_limit\": \"{{.arguments.amount_limit}}\",\n  \"currency_code\": \"USD\"\n}",
              "headers": {
                "Authorization": "{{.request.headers.Authorization}}"
              },
              "default_type_name": "CreateVelocityControlsResponse"
            }
          },
          {
            "kind": "REST",
            "name": "create_auth_controls",
            "internal": true,
            "root_fields": [
              {
                "type": "CreateUserResponse",
                "fields": [
                  "createAuthorizationControls"
                ]
              }
            ],
            "config": {
              "url": "tyk://0fb4636009414b5358e5c9591c3145a6/",
              "method": "POST",
              "body": "{\n  \"name\": \"123\",\n  \"merchant_scope\": {\n    \"mid\": \"{{.arguments.merchant.mid}}\"\n  }\n}",
              "headers": {
                "Authorization": "{{.request.headers.Authorization}}"
              },
              "default_type_name": "CreateAuthorizationControlsResponse"
            }
          },
          {
            "kind": "REST",
            "name": "create_users",
            "internal": true,
            "root_fields": [
              {
                "type": "Mutation",
                "fields": [
                  "createUser"
                ]
              }
            ],
            "config": {
              "url": "tyk://833f8d8f6f774d2a6c07d3cf1be0a885/",
              "method": "POST",
              "body": "{\n  \"first_name\": \"{{.arguments.customer.first_name}}\",\n  \"last_name\": \"{{.arguments.customer.last_name}}\",\n  \"postal_code\": \"{{.arguments.customer.postal_code}}\",\n  \"token\": \"{{.arguments.customer.uuid}}\"\n}",
              "headers": {
                "Authorization": "{{.request.headers.Authorization}}"
              },
              "default_type_name": "CreateUserResponse"
            }
          }
        ]
      },
      "type_field_configurations": [],
      "execution_mode": "executionEngine",
      "proxy": {
        "auth_headers": {}
      },
      "version": "2",
      "playground": {
        "enabled": false,
        "path": ""
      },
      "last_schema_update": "2021-07-23T14:39:30.787Z"
    },
    "hmac_allowed_clock_skew": -1,
    "dont_set_quota_on_create": false,
    "uptime_tests": {
      "check_list": [],
      "config": {
        "expire_utime_after": 0,
        "service_discovery": {
          "use_discovery_service": false,
          "query_endpoint": "",
          "use_nested_query": false,
          "parent_data_path": "",
          "data_path": "",
          "cache_timeout": 60
        },
        "recheck_wait": 0
      }
    },
    "enable_jwt": false,
    "do_not_track": false,
    "name": "vcn/onboard_user #VCN",
    "slug": "vcn/onboard_user",
    "oauth_meta": {
      "allowed_access_types": [],
      "allowed_authorize_types": [],
      "auth_login_redirect": ""
    },
    "CORS": {
      "enable": false,
      "max_age": 24,
      "allow_credentials": false,
      "exposed_headers": [],
      "allowed_headers": [
        "Origin",
        "Accept",
        "Content-Type",
        "X-Requested-With",
        "Authorization"
      ],
      "options_passthrough": false,
      "debug": false,
      "allowed_origins": [
        "*"
      ],
      "allowed_methods": [
        "GET",
        "POST",
        "HEAD"
      ]
    },
    "event_handlers": {
      "events": {}
    },
    "proxy": {
      "target_url": "",
      "service_discovery": {
        "endpoint_returns_list": false,
        "cache_timeout": 0,
        "parent_data_path": "",
        "query_endpoint": "",
        "use_discovery_service": false,
        "_sd_show_port_path": false,
        "target_path": "",
        "use_target_list": false,
        "use_nested_query": false,
        "data_path": "",
        "port_data_path": ""
      },
      "check_host_against_uptime_tests": false,
      "transport": {
        "ssl_insecure_skip_verify": false,
        "ssl_min_version": 0,
        "proxy_url": "",
        "ssl_ciphers": []
      },
      "target_list": [],
      "preserve_host_header": false,
      "strip_listen_path": true,
      "enable_load_balancing": false,
      "listen_path": "/vcn/onboard_user/",
      "disable_strip_slash": true
    },
    "client_certificates": [],
    "use_basic_auth": false,
    "version_data": {
      "not_versioned": true,
      "default_version": "",
      "versions": {
        "Default": {
          "name": "Default",
          "expires": "",
          "paths": {
            "ignored": [],
            "white_list": [],
            "black_list": []
          },
          "use_extended_paths": true,
          "extended_paths": {
            "ignored": [],
            "white_list": [],
            "black_list": [],
            "transform": [],
            "transform_response": [],
            "transform_jq": [],
            "transform_jq_response": [],
            "transform_headers": [],
            "transform_response_headers": [],
            "hard_timeouts": [],
            "circuit_breakers": [],
            "url_rewrites": [],
            "virtual": [],
            "size_limits": [],
            "method_transforms": [],
            "track_endpoints": [],
            "do_not_track_endpoints": [],
            "validate_json": [],
            "internal": []
          },
          "global_headers": {},
          "global_headers_remove": [],
          "global_response_headers": {},
          "global_response_headers_remove": [],
          "ignore_endpoint_case": false,
          "global_size_limit": 0,
          "override_target": ""
        }
      }
    },
    "jwt_scope_claim_name": "",
    "use_standard_auth": false,
    "session_lifetime": 0,
    "hmac_allowed_algorithms": [],
    "disable_rate_limit": false,
    "definition": {
      "location": "header",
      "key": "x-api-version",
      "strip_path": false
    },
    "use_oauth2": false,
    "jwt_source": "",
    "jwt_signing_method": "",
    "jwt_not_before_validation_skew": 0,
    "use_go_plugin_auth": false,
    "jwt_identity_base_field": "",
    "allowed_ips": [],
    "request_signing": {
      "is_enabled": false,
      "secret": "",
      "key_id": "",
      "algorithm": "",
      "header_list": [],
      "certificate_id": "",
      "signature_header": ""
    },
    "org_id": "60c78b219ee2c2000174433c",
    "enable_ip_whitelisting": false,
    "global_rate_limit": {
      "rate": 0,
      "per": 0
    },
    "protocol": "",
    "enable_context_vars": false,
    "tags": [],
    "basic_auth": {
      "disable_caching": false,
      "cache_ttl": 0,
      "extract_from_body": false,
      "body_user_regexp": "",
      "body_password_regexp": ""
    },
    "listen_port": 0,
    "session_provider": {
      "name": "",
      "storage_engine": "",
      "meta": {}
    },
    "auth_configs": {
      "authToken": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "x-amount-api-authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "basic": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "coprocess": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "hmac": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "jwt": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "oauth": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      },
      "oidc": {
        "use_param": false,
        "param_name": "",
        "use_cookie": false,
        "cookie_name": "",
        "auth_header_name": "Authorization",
        "use_certificate": false,
        "validate_signature": false,
        "signature": {
          "algorithm": "",
          "header": "",
          "secret": "",
          "allowed_clock_skew": 0,
          "error_code": 0,
          "error_message": ""
        }
      }
    },
    "strip_auth_data": false,
    "id": "60f84833f7c1a800014ef8a2",
    "certificates": [],
    "enable_signature_checking": false,
    "use_openid": false,
    "internal": false,
    "jwt_skip_kid": false,
    "enable_batch_request_support": false,
    "enable_detailed_recording": true,
    "response_processors": [],
    "use_mutual_tls_auth": false
  },
  "hook_references": [],
  "is_site": false,
  "sort_by": 0,
  "user_group_owners": [],
  "user_owners": []
}

Hi @Fahad_Ahmed

Thanks for bringing this our attention. I can observe the same thing after importing the API definition.

I will check with team and find out if this is possible.

Hi @Fahad_Ahmed

I checked a previous version (3.1.0 to be exact) and found it was working as expected. So I have filed a bug request with the engineering team.

I don’t think there is a workaround at the moment and we do apologize for the inconvenience. I have set a high priority on the bug request and will let you know when I get an update from the engineering team.

Hi @Fahad_Ahmed
I also encountered this issue and the only way I found to overcome this right now is to send the whole input as the body instead of mapping its fields to JSON payload. Like so {{ .arguments.input }} or {{ .arguments.customer }} in your case. If you are using a dashboard to configure the request body it may complain that something is wrong with the request body but it actually works.

Hey @Fahad_Ahmed!
I’m from the UDG team, this issue was brought to my attention today.
We’ll look into this and come back with more info.