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

labd/commercetools v1.15.0 : panic: runtime error: invalid memory address or nil pointer dereference #519

Closed
vladide opened this issue Sep 2, 2024 · 1 comment · Fixed by #520
Labels
bug Something isn't working

Comments

@vladide
Copy link

vladide commented Sep 2, 2024

Version information

  • terraform: v1.8.5, 1.9.5
  • terraform provider: 1.15.0

Describe the bug

Error: Request cancelled
│ 
│   with module.commercetools-shared.commercetools_subscription.cmi[0],
│   on ./xyz/subscription.tf line 2, in resource "commercetools_subscription" "cmi":
│    2: resource "commercetools_subscription" "cmi" {
│ 
│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│   with module.commercetools.commercetools_shipping_method.npu[0],
│   on ./xyz/shipping_method.tf line 16, in resource "commercetools_shipping_method" "npu":
│   16: resource "commercetools_shipping_method" "npu" {
│ 
│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│   with module.commercetools.commercetools_shipping_method.delivery[0],
│   on ./xyz/shipping_method.tf line 37, in resource "commercetools_shipping_method" "delivery":
│   37: resource "commercetools_shipping_method" "delivery" {
│ 
│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.commercetools.commercetools_shipping_zone_rate.hd[0],
│   on ./xyz/shipping_zone_rate.tf line 2, in resource "commercetools_shipping_zone_rate" "hd":
│    2: resource "commercetools_shipping_zone_rate" "hd" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-commercetools_v1.15.0 plugin:

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

goroutine 883 [running]:
github.com/labd/terraform-provider-commercetools/commercetools.setShippingZoneRateState(0x14000481a80, 0x1058f44a0?)
        github.com/labd/terraform-provider-commercetools/commercetools/resource_shipping_zone_rate.go:448 +0x2b8
github.com/labd/terraform-provider-commercetools/commercetools.resourceShippingZoneRateRead({0x1058f44a0, 0x14000512850}, 0x14000481a80, {0x1058d6720?, 0x140001232f0})
        github.com/labd/terraform-provider-commercetools/commercetools/resource_shipping_zone_rate.go:251 +0x288
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x14000391500, {0x1058f43f8, 0x14000b65aa0}, 0xd?, {0x1058d6720, 0x140001232f0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/resource.go:823 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x14000391500, {0x1058f43f8, 0x14000b65aa0}, 0x14000ad80d0, {0x1058d6720, 0x140001232f0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/resource.go:1117 +0x430
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x1400019d9e0, {0x1058f43f8?, 0x14000b65950?}, 0x14000b05840)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/grpc_provider.go:708 +0x5ac
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadResource(0x1058f4430?, {0x1058f43f8?, 0x14000b65560?}, 0x14000b05840)
        github.com/hashicorp/terraform-plugin-mux@v0.16.0/tf5muxserver/mux_server_ReadResource.go:35 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x140002c5f40, {0x1058f43f8?, 0x14000b64b70?}, 0x14000512230)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/tf5server/server.go:783 +0x224
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x10589a5a0?, 0x140002c5f40}, {0x1058f43f8, 0x14000b64b70}, 0x14000481780, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000227000, {0x1058f43f8, 0x14000b64ae0}, {0x1058fa460, 0x140004f0000}, 0x14000a837a0, 0x140003b7e30, 0x1061bc6c8, 0x0)
        google.golang.org/grpc@v1.63.2/server.go:1369 +0xba0
google.golang.org/grpc.(*Server).handleStream(0x14000227000, {0x1058fa460, 0x140004f0000}, 0x14000a837a0)
        google.golang.org/grpc@v1.63.2/server.go:1780 +0xc80
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 36
        google.golang.org/grpc@v1.63.2/server.go:1030 +0x150

Error: The terraform-provider-commercetools_v1.15.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

To Reproduce

Resources : commercetools_subscription ,commercetools_shipping_method , commercetools_shipping_zone_rate

Provider config :

    commercetools = {
      source  = "labd/commercetools"
      version = "1.15.0"
    }

Works in v 1.14.3, provider version downgrade fixes temporarily the issue.
Independent of Terraform version ( tested on TF 1.8.5 , 1.9.5(latest) ) ; pipelines & macos terraform plan show same issue )
Shows the same issue during a terraform plan

Expected behavior

Clean terraform apply

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@vladide vladide added bug Something isn't working triage Needs triage labels Sep 2, 2024
@demeyerthom demeyerthom removed the triage Needs triage label Sep 2, 2024
@demeyerthom
Copy link
Member

Hi @vladide same bug as #518. I will create a fix for this later today!

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

Successfully merging a pull request may close this issue.

2 participants