Skip to content

Nil pointer dereference in Endpoint.Diff when updating template imageName #24

@kennethlynne

Description

@kennethlynne

Description

I encountered a nil pointer dereference panic in the RunPod Pulumi provider when attempting to update a serverless endpoint template's imageName. The panic occurs during the Diff operation when Pulumi tries to preview changes.

Error Details

Stack Trace

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x58 pc=0x1031f6b50]

goroutine 52 [running]:
github.com/runpod/pulumi-runpod-native/provider/pkg/provider.(*Endpoint).Diff(0x1400083a000, {0x103797298, 0x14000618900}, 0x140003ce000)
    /home/runner/work/pulumi-runpod-native/pulumi-runpod-native/provider/pkg/provider/endpoint.go:231 +0x2e0
github.com/pulumi/pulumi/pkg/v3/resource/provider.(*DiffRequest).do(0x140003ce000, {0x103797298, 0x14000618900}, 0x1400083a000)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.126.0/resource/provider/component_provider.go:370 +0x164

Full Error Message

error: preview failed

Error: invocation of runpod:index:Endpoint returned an error: error reading from server: EOF

Steps to Reproduce

  1. Create a RunPod serverless endpoint with a template using the Pulumi provider:

    const template = new runpod.Template('my-template', {
      containerDiskInGb: 10,
      dockerArgs: 'python -u rp_handler.py',
      imageName: 'myregistry.com/myimage:v0.1.0',
      isServerless: true,
      name: 'my-worker',
    });
    
    const endpoint = new runpod.Endpoint('my-endpoint', {
      name: 'my-endpoint',
      templateId: template.template.apply(t => t.id),
      gpuIds: 'AMPERE_16',
    });
  2. Deploy the infrastructure successfully with pulumi up

  3. Update the template's imageName to a new version:

    imageName: 'myregistry.com/myimage:v0.2.0',
  4. Run pulumi up to preview/apply the changes

  5. The provider crashes with a nil pointer dereference during the Diff operation

Environment

  • OS: macOS 15.6.1 (24G90)
  • Platform: darwin/arm64
  • Pulumi Version: v3.163.0
  • RunPod Provider Version: @runpod-infra/pulumi v1.9.99
  • Node.js Version: v22.x
  • TypeScript Version: 5.x

Expected Behavior

The provider should successfully calculate the diff between the current and desired state when the template's imageName changes, and apply the update without crashing.

Actual Behavior

The provider crashes with a nil pointer dereference error

Workaround

Currently, we can work around this issue by using the --skip-preview flag:

pulumi up --skip-preview

However, this is not ideal as it bypasses the safety checks that preview provides.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions