1

I just set up a NodeJS based site on Google Cloud using the Cloud Run service.

There are two DNS records: A (IPv4) and AAAA (IPv6). Whenever I access the site using Chrome, my Chrome picks the IPv6 address and NodeJS app fails hard:

TypeError [ERR_INVALID_URL]: Invalid URL: http://2001:14ba:98ae:1700:****:****:****:****/
  at onParseError (internal/url.js:257:9)
  at new URL (internal/url.js:333:5)

Note: I censored the address

If I force my browser to use the IPv4 address, then the site works fine.

Is there a way to make the Cloud Run service use IPv4 to the container/app? I don't mind IPv6 at the client <-> Cloud Run level.

My Cloud Run YAML looks like:

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: xxx-dev-app-825af7f
  namespace: 'xxx'
  selfLink: /apis/serving.knative.dev/v1/namespaces/xxx/services/xxx-dev-app-825af7f
  uid: 2d787ef2-39a7-xxx-yyy-zzz
  resourceVersion: AAWfuzEBUYA
  generation: 5
  creationTimestamp: '2020-02-26T18:58:40.504717Z'
  labels:
    cloud.googleapis.com/location: europe-north1
  annotations:
    run.googleapis.com/client-name: gcloud
    serving.knative.dev/creator: pulumi@xxx.iam.gserviceaccount.com
    serving.knative.dev/lastModifier: xxx@cloudbuild.gserviceaccount.com
    client.knative.dev/user-image: gcr.io/xxx/app:4860b1e137457b0e42a1896d7b95e0348d8cd7e4
    run.googleapis.com/client-version: 279.0.0
spec:
  traffic:
  - percent: 100
    latestRevision: true
  template:
    metadata:
      name: xxx-dev-app-825af7f-00005-xoz
      annotations:
        run.googleapis.com/client-name: gcloud
        client.knative.dev/user-image: gcr.io/xxx/app:4860b1e137457b0e42a1896d7b95e0348d8cd7e4
        run.googleapis.com/client-version: 279.0.0
        autoscaling.knative.dev/maxScale: '1000'
    spec:
      timeoutSeconds: 900
      containerConcurrency: 80
      containers:
      - image: gcr.io/xxx/app:4860b1e137457b0e42a1896d7b95e0348d8cd7e4
        ports:
        - containerPort: 8080
        resources:
          limits:
            cpu: 1000m
            memory: 256Mi
          requests:
            cpu: 200m
            memory: 64Mi
status:
  conditions:
  - type: Ready
    status: 'True'
    lastTransitionTime: '2020-02-29T18:33:33.424Z'
  - type: ConfigurationsReady
    status: 'True'
    lastTransitionTime: '2020-02-29T18:33:28.264Z'
  - type: RoutesReady
    status: 'True'
    lastTransitionTime: '2020-02-29T18:33:33.424Z'
  observedGeneration: 5
  traffic:
  - revisionName: xxx-dev-app-825af7f-00005-xoz
    percent: 100
    latestRevision: true
  latestReadyRevisionName: xxx-dev-app-825af7f-00005-xoz
  latestCreatedRevisionName: xxx-dev-app-825af7f-00005-xoz
  address:
    url: https://xxx.run.app
  url: https://xxx.run.app
Kai Sellgren
  • 20,678
  • 7
  • 66
  • 80

2 Answers2

1

AFAIK, IPv6 is only supported at Global Load balancer only. This load balancer proxied the connection and convert it to IPv4 for internal access into Google Network.Thereby, direct access to Cloud Run with IPv6 seems impossible.

However, things are in progress, especially around Load Balancing and it could solve your issue. Maybe announcements at Cloud Next in April. Stay tuned!

guillaume blaquiere
  • 33,758
  • 2
  • 11
  • 37
1

For the connections between Cloud Run <=> user browser: You currently cannot disable the IPv6 stack.

(As Guillaume said, upcoming support for configurable Cloud HTTPS Load Balancer would solve your problem –in fact, IPv4 is the default for GCLB, and you explicitly need to configure an IPv6 address if you want IPv6 for your GCLB).

For connections between Cloud Run Service <=> Cloud Run Service: You should be fully control what IP you connect to, on the client side.

For example, on the client side,

AhmetB - Google
  • 35,086
  • 32
  • 117
  • 191