jianyuan/terraform-provider-sentry

Plugin crashes in sentry.followShape

Closed this issue · 5 comments

Recently this plugins started crashing with an error that is hard to understand what's going on:

╷
│ Error: Plugin did not respond
│ 
│   with sentry_project.****,
│   on projects.tf line 279, in resource "sentry_project" "default":
│  279: resource "sentry_project" "default" {
│ 
│ 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-sentry_v0.11.2 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 707 [running]:
github.com/jianyuan/terraform-provider-sentry/sentry.followShape({0xb3e080?, 0xc0003f5170?}, {0xb3e080?, 0xc0003f51b8?})
	github.com/jianyuan/terraform-provider-sentry/sentry/helpers.go:79 +0x405
github.com/jianyuan/terraform-provider-sentry/sentry.resourceSentryIssueAlertRead({0xd8cf48, 0xc0007da840}, 0xc000294b80, {0xb9ea40?, 0xc000456780})
	github.com/jianyuan/terraform-provider-sentry/sentry/resource_sentry_issue_alert.go:226 +0x79c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0002c6620, {0xd8cf80, 0xc00047de90}, 0xd?, {0xb9ea40, 0xc000456780})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:724 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0002c6620, {0xd8cf80, 0xc00047de90}, 0xc00054bee0, {0xb9ea40, 0xc000456780})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:1015 +0x585
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000454ab0, {0xd8cf80?, 0xc00047dd70?}, 0xc000561580)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:613 +0x4a5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0004560a0, {0xd8cf80?, 0xc00047d7a0?}, 0xc0007da300)
	github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/tf5server/server.go:748 +0x4b1
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xc2cf00?, 0xc0004560a0}, {0xd8cf80, 0xc00047d7a0}, 0xc0000d4070, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000476000, {0xd90980, 0xc0000071e0}, 0xc0006ab8c0, 0xc00047cf60, 0x12280d0, 0x0)
	google.golang.org/grpc@v1.50.1/server.go:1340 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc000476000, {0xd90980, 0xc0000071e0}, 0xc0006ab8c0, 0x0)
	google.golang.org/grpc@v1.50.1/server.go:1713 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/grpc@v1.50.1/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.50.1/server.go:963 +0x28a

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

I tried to reimport state but that did not help.

This behavior was introduced by 0.11.2.

Reverting to 0.11.1 fixed the issue.

Thanks, I confirm. Downgrading worked for us.

This might work but we use platform = "react-native" in a project and that breaks in 0.11.1, @jianyuan any update on this?

I see the crash also with 0.11.1.

v0.12.0 now uses JSON strings for defining conditions, filters, and actions. This runtime error should not crop up anymore. https://registry.terraform.io/providers/jianyuan/sentry/latest/docs/resources/issue_alert