Skip to Content
1
Jan 30, 2023 at 11:57 AM

Connectivity-Proxy in KYMA not working

395 Views Last edit Jan 30, 2023 at 12:06 PM 3 rev

Hi,

i tried to follow the tutorial but directly tried to use an internally available system.

but it is not working for me. I am not sure what my problem is.

Could someone help me?

Cloud connector seems to find the internal system

cloudconnector.jpg

The connectivity proxy service is bound to the namespace and the pod is running. It exists 2 times because there are 2 namespaces which are creating a service instance and binding it. Could that be an issue?

image.png

image.png

Deployed KYMA function

apiVersion: serverless.kyma-project.io/v1alpha2
kind: Function
metadata:
  name: stage-call-sample
spec:
  env:
  - name: cc_url
    value: http://stage:50200/api/data
  runtime: nodejs16
  source:
    inline:
      dependencies: "{ \n  \"name\": \"cc-sample\",\n  \"version\": \"1.0.0\",\n  \"dependencies\":
        {\n    \"axios\": \"0.21.4\"\n  }\n}"
      source: |
        const axios = require("axios");
        module.exports = {
          main: async function (event, context) {
            try {
              const body = {
                somedata: "1234",
              };
              var result = await axios.get(process.env.cc_url, {
                headers: {
                  "Content-Type": "application/json",
                  "SAP-Connectivity-SCC-Location_ID": "",
                  "Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
                },
                proxy: {
                  protocol: "http",
                  host: "connectivity-proxy.kyma-system.svc.cluster.local",
                  port: 20003,
                }
              });
              return result.data;
            } catch (error) {
              console.log("an error occurred: ", error);
              return "an error occurred...";
            }
          },
        };<br>

APIRule used for triggering the request:

apiVersion: gateway.kyma-project.io/v1beta1
kind: APIRule
metadata:
  name: stage-call-sample-apirule
spec:
  gateway: kyma-gateway.kyma-system.svc.cluster.local
  host: cc-sample
  service:
    name: stage-call-sample
    port: 80
  rules:
  - accessStrategies:
    - config: {}
      handler: allow
    methods:
    - GET
    - POST
    - PUT
    - DELETE
    - PATCH
    - HEAD
    path: /.*<br>

When i now call the URL provided by the APIRule following happens:

image.png

The logs of the function pod:

image.png

Can someone help me?

Thanks in advance!

Attachments

cloudconnector.jpg (191.8 kB)
image.png (65.3 kB)
image.png (76.7 kB)
image.png (12.9 kB)
image.png (193.5 kB)
image.png (12.9 kB)
image.png (193.5 kB)