webbankir / terraform-provider-apisix

Terraform provider for Apisix
6 stars 4 forks source link

Plugin Crash #3

Open JorgeAraujo123 opened 1 year ago

JorgeAraujo123 commented 1 year ago

Hello, When testing the plugin with a simple install:

resource "apisix_upstream" "test" {
  name = "test"
  type = "roundrobin"
  nodes          = [
  {
  host   = "1.1.1.1"
  port   = 80
  weight = 1
},
]

The plugin crashes:

╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-apisix plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 67 [running]:
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.parseHttpResult(0xc000546000, 0xc0000e0400, 0x1e3, 0x200, 0x1e3, 0x200, 0x0, 0x0, 0xc000287001, 0xc00042f6e0)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:67 +0x526
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.Get(0xc0001cef30, 0x27, 0x11e8960, 0xc0004404c0, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:87 +0x1d1
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.RunObject(0xc0001cef30, 0x27, 0x11e8960, 0xbe0528, 0x3, 0xc0004404c0, 0x1f, 0x0, 0x0, 0x0, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:182 +0x389
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.GetUpstream(...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client_upstream.go:4
github.com/webbankir/terraform-provider-apisix/apisix.ResourceUpstreamType.Read(0x203000, 0xc0001cef30, 0x27, 0x11e8960, 0xcfe4a0, 0xc000422340, 0xd04e40, 0xc00042bf50, 0xb06160, 0xc000428b10, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/resource_apisix_upstream.go:86 +0x1b5
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).readResource(0xc0005a24e0, 0xcfe4a0, 0xc000422340, 0xc000422300, 0xc000287a18)
        github.com/hashicorp/terraform-plugin-framework@v0.5.0/tfsdk/serve.go:571 +0x683
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).ReadResource(0xc0005a24e0, 0xcfe4a0, 0xc0004222c0, 0xc000422300, 0xbea4d5, 0x12, 0x0)
        github.com/hashicorp/terraform-plugin-framework@v0.5.0/tfsdk/serve.go:506 +0xe4
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc000212300, 0xcfe4a0, 0xc0004222c0, 0xc00059da40, 0x0, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov6/tf6server/server.go:554 +0x30d
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler(0xbb3340, 0xc000212300, 0xcfe560, 0xc000417170, 0xc00059d9e0, 0x0, 0xcfe560, 0xc000417170, 0xc00040a2c0, 0x14c)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:345 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400, 0xc0005a25d0, 0x11dcf10, 0x0, 0x0, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1194 +0x50a
google.golang.org/grpc.(*Server).handleStream(0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1517 +0xcfb
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000202190, 0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400)
        google.golang.org/grpc@v1.32.0/server.go:859 +0xa1
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.32.0/server.go:857 +0x204

Error: The terraform-provider-apisix 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.

Can you please help me? Thanks

suslovsergey commented 1 year ago

@JorgeAraujo123 Hi! I can check/fix provider only on next week. Sorry :(

JorgeAraujo123 commented 1 year ago

Any news on this @suslovsergey ?