Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-3869

APICast: on null api_backend system raise an error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • None
    • 2.7 CR1
    • Gateway
    • None
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      Gui discover this one testing with APICast 2.7 version.

      Config:

      {
        "services": [
      {
          "id": 3,
          "account_id": 2,
          "name": "Coding",
          "oneline_description": null,
          "description": "",
          "txt_api": null,
          "txt_support": null,
          "txt_features": null,
          "created_at": "2019-11-07T13:10:49Z",
          "updated_at": "2019-11-07T14:24:10Z",
          "logo_file_name": null,
          "logo_content_type": null,
          "logo_file_size": null,
          "state": "incomplete",
          "intentions_required": false,
          "draft_name": "",
          "infobar": null,
          "terms": null,
          "display_provider_keys": false,
          "credit_card_support_email": null,
          "buyers_manage_apps": true,
          "buyers_manage_keys": true,
          "custom_keys_enabled": true,
          "buyer_plan_change_permission": "request",
          "buyer_can_select_plan": false,
          "notification_settings": null,
          "default_application_plan_id": null,
          "default_service_plan_id": null,
          "default_end_user_plan_id": null,
          "end_user_registration_required": true,
          "tenant_id": 2,
          "system_name": "coding",
          "backend_version": "1",
          "mandatory_app_key": true,
          "buyer_key_regenerate_enabled": true,
          "support_email": "admin@3scale.27cr1.apps.devel-ocp-41-ga.3sca.net",
          "referrer_filters_required": false,
          "deployment_option": "hosted",
          "kubernetes_service_link": null,
          "tech_support_email": null,
          "admin_support_email": null,
          "act_as_product": 0,
          "proxiable?": true,
          "backend_authentication_type": "service_token",
          "backend_authentication_value": "acb2bd816c3cd35c0868686e38bebbcd84eca2087c0cd6761ba058c17f6e40bc",
          "proxy": {
              "id": 3,
              "tenant_id": 2,
              "service_id": 3,
              "endpoint": "https://coding-3scale-apicast-production.27cr1.apps.devel-ocp-41-ga.3sca.net:443",
              "deployed_at": null,
              "auth_app_key": "app_key",
              "auth_app_id": "app_id",
              "auth_user_key": "user_key",
              "credentials_location": "query",
              "error_auth_failed": "Authentication failed",
              "error_auth_missing": "Authentication parameters missing",
              "created_at": "2019-11-07T13:10:49Z",
              "updated_at": "2019-11-07T14:24:10Z",
              "error_status_auth_failed": 403,
              "error_headers_auth_failed": "text/plain; charset=us-ascii",
              "error_status_auth_missing": 403,
              "error_headers_auth_missing": "text/plain; charset=us-ascii",
              "error_no_match": "No Mapping Rule matched",
              "error_status_no_match": 404,
              "error_headers_no_match": "text/plain; charset=us-ascii",
              "secret_token": "Shared_secret_sent_from_proxy_to_API_backend_b30f54dd0aae20ab",
              "hostname_rewrite": null,
              "oauth_login_url": null,
              "sandbox_endpoint": "https://coding-3scale-apicast-staging.27cr1.apps.devel-ocp-41-ga.3sca.net:443",
              "api_test_path": "/",
              "api_test_success": null,
              "apicast_configuration_driven": true,
              "oidc_issuer_endpoint": null,
              "lock_version": 0,
              "authentication_method": "1",
              "oidc_issuer_type": "keycloak",
              "error_headers_limits_exceeded": "text/plain; charset=us-ascii",
              "error_status_limits_exceeded": 429,
              "error_limits_exceeded": "Usage limit exceeded",
              "staging_domain": "coding-3scale-apicast-staging.27cr1.apps.devel-ocp-41-ga.3sca.net",
              "production_domain": "coding-3scale-apicast-production.27cr1.apps.devel-ocp-41-ga.3sca.net",
              "api_backend": null,
              "hostname_rewrite_for_sandbox": "api.github.com",
              "endpoint_port": 443,
              "valid?": true,
              "service_backend_version": "1",
              "hosts": [
                  "coding-3scale-apicast-production.27cr1.apps.devel-ocp-41-ga.3sca.net",
                  "coding-3scale-apicast-staging.27cr1.apps.devel-ocp-41-ga.3sca.net",
                  "eloy"
              ],
              "backend": {
                  "endpoint": "https://backend-3scale.27cr1.apps.devel-ocp-41-ga.3sca.net",
                  "host": "backend-3scale.27cr1.apps.devel-ocp-41-ga.3sca.net"
              },
              "policy_chain": [
                  {
                      "name": "routing",
                      "version": "builtin",
                      "enabled": true,
                      "configuration": {
                          "rules": [
                              {
                                  "url": "https://ipinfo.io:443",
                                  "owner_id": 4,
                                  "owner_type": "BackendApi",
                                  "condition": {
                                      "operations": [
                                          {
                                              "match": "path",
                                              "op": "matches",
                                              "value": "/ip/.*|/ip/?"
                                          }
                                      ]
                                  },
                                  "replace_path": "{{original_request.path | remove_first: '/ip'}}"
                              },
                              {
                                  "url": "https://api.github.com:443",
                                  "owner_id": 3,
                                  "owner_type": "BackendApi",
                                  "condition": {
                                      "operations": [
                                          {
                                              "match": "path",
                                              "op": "matches",
                                              "value": "/gh/.*|/gh/?"
                                          }
                                      ]
                                  },
                                  "replace_path": "{{original_request.path | remove_first: '/gh'}}"
                              }
                          ]
                      }
                  },
                  {
                      "name": "apicast",
                      "version": "builtin",
                      "configuration": {}
                  }
              ],
              "jwt_claim_with_client_id": null,
              "jwt_claim_with_client_id_type": null,
              "proxy_rules": [
                  {
                      "id": 3,
                      "proxy_id": null,
                      "http_method": "GET",
                      "pattern": "/gh/users/",
                      "metric_id": 8,
                      "metric_system_name": "hits.3",
                      "delta": 1,
                      "tenant_id": null,
                      "created_at": "2019-11-07T12:03:23Z",
                      "updated_at": "2019-11-07T14:23:59Z",
                      "redirect_url": null,
                      "position": 1,
                      "last": false,
                      "owner_id": 3,
                      "owner_type": "BackendApi"
                  },
                  {
                      "id": 4,
                      "proxy_id": null,
                      "http_method": "GET",
                      "pattern": "/ip",
                      "metric_id": 9,
                      "metric_system_name": "hits.4",
                      "delta": 1,
                      "tenant_id": null,
                      "created_at": "2019-11-07T13:10:09Z",
                      "updated_at": "2019-11-07T14:24:09Z",
                      "redirect_url": null,
                      "position": 1,
                      "last": false,
                      "owner_id": 4,
                      "owner_type": "BackendApi"
                  }
              ]
          }
      }
        ]}
      
      

      Error

      2019/11/07 14:27:23 [error] 24#24: *1351 lua entry thread aborted: runtime error: /opt/app-root/src/lua_modules/share/lua/5.1/resty/url.lua:26: bad argument #1 to 'find' (string expected, got userdata)
      stack traceback:
      coroutine 0:
      	[C]: in function 'find'
      	/opt/app-root/src/lua_modules/share/lua/5.1/resty/url.lua:26: in function 'scheme'
      	/opt/app-root/src/lua_modules/share/lua/5.1/resty/url.lua:104: in function 'split'
      	/opt/app-root/src/src/resty/url_helper.lua:26: in function 'parse_url'
      	/opt/app-root/src/src/apicast/upstream.lua:37: in function 'new'
      	/opt/app-root/src/src/apicast/proxy.lua:191: in function 'get_upstream'
      	/opt/app-root/src/src/apicast/policy/apicast/apicast.lua:63: in function </opt/app-root/src/src/apicast/policy/apicast/apicast.lua:35>
      	/opt/app-root/src/src/apicast/policy_chain.lua:200: in function 'rewrite'
      	...-root/src/src/apicast/policy/local_chain/local_chain.lua:59: in function <...-root/src/src/apicast/policy/local_chain/local_chain.lua:54>
      	/opt/app-root/src/src/apicast/policy_chain.lua:200: in function 'rewrite'
      	rewrite_by_lua(lua_FIrexJ:525):3: in main chunk, client: 10.131.3.195, server: _, request: "GET /ip/?user_key=6827a93684cea5fcec6ce0c3eb1704f0 HTTP/1.1", host: "coding-3scale-apicast-staging.27cr1.apps.devel-ocp-41-ga.3sca.net"
      [07/Nov/2019:14:27:23 +0000] coding-3scale-apicast-staging.27cr1.apps.devel-ocp-41-ga.3sca.net:8080 10.131.3.195:37250 "GET /ip/?user_key=6827a93684cea5fcec6ce0c3eb1704f0 HTTP/1.1" 500 174 (0.044) 0
      

              Unassigned Unassigned
              eloycoto Eloy Coto
              Eloy Coto Eloy Coto
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: