Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer dereference when using type: FromCompositeFieldPath and omitting valueFromFieldPath #23

Open
sschne opened this issue Jul 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sschne
Copy link

sschne commented Jul 15, 2024

What happened?

When adding a pipeline step that uses selector with FromCompositeFieldPath and omitting valueFromFieldPath, the function crashes with nil pointer dereference

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13e4292]

goroutine 7 [running]:
main.buildRequirements(0xc000244780, 0xc000225130)
        /fn/fn.go:140 +0x4d2
main.(*Function).RunFunction(0xc00040c7f0, {0xc0006800c0?, 0x499ae6?}, 0xc0006800c0)
        /fn/fn.go:57 +0x265
github.com/crossplane/function-sdk-go/proto/v1beta1._FunctionRunnerService_RunFunction_Handler({0x1506580?, 0xc00040c7f0}, {0x190c0a0, 0xc0001ee930}, 0xc00050c080, 0x0)
        /go/pkg/mod/github.com/crossplane/[email protected]/proto/v1beta1/run_function_grpc.pb.go:104 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001b6e00, {0x190c0a0, 0xc0001ee690}, {0x1911900, 0xc0001f6680}, 0xc0000ec000, 0xc0000afb60, 0x23f39c0, 0x0)
        /go/pkg/mod/google.golang.org/[email protected]/server.go:1385 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0001b6e00, {0x1911900, 0xc0001f6680}, 0xc0000ec000)
        /go/pkg/mod/google.golang.org/[email protected]/server.go:1796 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 24
        /go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x135

How can we reproduce it?

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: function-environment-configs
spec:
  compositeTypeRef:
    apiVersion: example.crossplane.io/v1
    kind: XR
  mode: Pipeline
  pipeline:
  - step: pull-extra-resources
    functionRef:
      name: function-extra-resources
    input:
      apiVersion: extra-resources.fn.crossplane.io/v1beta1
      kind: Input
      spec:
        extraResources:
          - kind: XCluster
            into: XCluster
            apiVersion: example.crossplane.io/v1
            type: Selector
            selector:
              maxMatch: 2
              minMatch: 1
              matchLabels:
                - key: type
                  type: FromCompositeFieldPath
                  value: cluster

What environment did it happen in?

Function version: 0.0.3

@sschne sschne added the bug Something isn't working label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant