configcat / terraform-provider-configcat

Terraform Provider for ConfigCat. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
https://configcat.com
MIT License
8 stars 2 forks source link

panic on nil pointer #28

Closed txomon closed 9 months ago

txomon commented 10 months ago

If you're not sure whether your problem is specifically related to this repository, or to the ConfigCat service overall, please contact the ConfigCat support. This issue tracker is intended only for feedback on the content of this repository.

Describe the bug

Crash while planning

To reproduce

Not sure how to reproduce but this shouldn't be happening...

Expected behavior

Not crashing

Screenshots

None

Stacktrace

╷
│ Error: Request cancelled
│
│   with provider["registry.terraform.io/configcat/configcat"],
│   on terraform.tf line 52, in provider "configcat":
│   52: provider "configcat" {
│
│ The plugin.(*GRPCProvider).ConfigureProvider request was cancelled.
╵

Stack trace from the terraform-provider-configcat_v2.0.2 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x97966d]

goroutine 30 [running]:
github.com/configcat/terraform-provider-configcat/configcat.(*Client).GetMe(0xc0002fce40)
        github.com/configcat/terraform-provider-configcat/configcat/client.go:29 +0x12d
github.com/configcat/terraform-provider-configcat/configcat.NewClient({0xd5eb14, 0x19}, {0xc0000461ae, 0x24}, {0xc0000461fe, 0x2c})
        github.com/configcat/terraform-provider-configcat/configcat/client.go:53 +0x251
github.com/configcat/terraform-provider-configcat/configcat.providerConfigure({0xd4e6d1?, 0x6?}, 0xc0003032c0?)
        github.com/configcat/terraform-provider-configcat/configcat/provider.go:107 +0xe9
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xc0000a7020, {0xe93120, 0xc0003032c0}, 0xd?)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/provider.go:300 +0x1f5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xc00040be60, {0xe93120?, 0xc000302e10?}, 0xc000684c00)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:593 +0x345
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).Configure(0xc0001bafa0, {0xe93120?, 0xc0003025d0?}, 0xc00068ee40)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:597 +0x2d3
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_Configure_Handler({0xd1be40?, 0xc0001bafa0}, {0xe93120, 0xc0003025d0}, 0xc00069d810, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:413 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001c61e0, {0xe96d60, 0xc000282d00}, 0xc0000cc360, 0xc00041b200, 0x13eaa10, 0x0)
        google.golang.org/grpc@v1.58.2/server.go:1376 +0xdf1
google.golang.org/grpc.(*Server).handleStream(0xc0001c61e0, {0xe96d60, 0xc000282d00}, 0xc0000cc360, 0x0)
        google.golang.org/grpc@v1.58.2/server.go:1753 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.58.2/server.go:998 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.58.2/server.go:996 +0x18c

Error: The terraform-provider-configcat_v2.0.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.
laliconfigcat commented 10 months ago

Hello @txomon ,

Thanks for reporting the issue. Could you please show us the terraform configuration files related to ConfigCat and some information about the system where Terraform is running you are using (OS type/version, Terraform version, GO version)?

Thanks in advance, Lali

txomon commented 10 months ago

Hello Lajos,

I'm not sure there is anything worth mentioning... We are using the following config:

Terraform v1.5.7 on linux_amd64

And there was nothing really going on, the configcat provider was instantiated taking advantage of the environment variables, and it failed early on.

Cheers, Javier

On Thu, Dec 14, 2023 at 9:20 AM Lajos Szoke @.***> wrote:

Hello @txomon https://github.com/txomon ,

Thanks for reporting the issue. Could you please show us the terraform configuration files related to ConfigCat and some information about the system where Terraform is running you are using (OS type/version, Terraform version, GO version)?

Thanks in advance, Lali

— Reply to this email directly, view it on GitHub https://github.com/configcat/terraform-provider-configcat/issues/28#issuecomment-1855384015, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXXGUQL2LA5GDXIJ4A5YTYJKZD7AVCNFSM6AAAAABATVJRWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJVGM4DIMBRGU . You are receiving this because you were mentioned.Message ID: @.***>

laliconfigcat commented 10 months ago

Hello Javier,

Thanks for these information. I just tried it locally on windows and ubuntu too with 1.5.7 and it worked for me. Could you please also share your terraform configuration files? Is this issue happening all the time or in just some cases? Do you run it on TF cloud or locally? Do you have any firewall rules on the machine?

Cheers,

txomon commented 10 months ago

Hello Lajos,

This is the only time I had that issue and I was unable to reproduce. I can only say that the connectivity I had when running the plan was not optimal, so maybe some

I can only suppose there is something wrong with the initialization of the apiClient that caused a panic like this one and may only be hit in some situations.

Cheers, Javier

On Fri, Dec 15, 2023 at 11:24 AM Lajos Szoke @.***> wrote:

Hello Javier,

Thanks for these information. I just tried it locally on windows and ubuntu too with 1.5.7 and it worked for me. Could you please also share your terraform configuration files? Is this issue happening all the time or in just some cases? Do you run it on TF cloud or locally? Do you have any firewall rules on the machine?

Cheers,

— Reply to this email directly, view it on GitHub https://github.com/configcat/terraform-provider-configcat/issues/28#issuecomment-1857629271, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXXGRJLQOSIK5UB5WQCKDYJQQPBAVCNFSM6AAAAABATVJRWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJXGYZDSMRXGE . You are receiving this because you were mentioned.Message ID: @.***>

laliconfigcat commented 10 months ago

Thanks, this extra information helped me a lot. I killed my network adapter during integ tests and I could reproduce the issue. I'll release a new version soon with the fix.

laliconfigcat commented 10 months ago

I will release v3.0.0 soon with a breaking change, but I prioritized this issue higher and just released v2.2.0 with the fix so you can update to a fixed version without a breaking change. I hope it will work for you.

If you are happy with our service, please help us grow by leaving a review. https://www.trustradius.com/welcome/configcat It really makes a difference for us.

laliconfigcat commented 9 months ago

Hello @txomon ,

I'm closing this issue. Let us know if you experience any issue in the future. Thanks again for reporting this.

Cheers,