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

panic: runtime error: invalid memory address or nil pointer dereference #88

Closed
ari-becker opened this issue Jun 24, 2021 · 12 comments · Fixed by #108
Closed

panic: runtime error: invalid memory address or nil pointer dereference #88

ari-becker opened this issue Jun 24, 2021 · 12 comments · Fixed by #108
Assignees
Labels
bug Something isn't working

Comments

@ari-becker
Copy link
Contributor

ari-becker commented Jun 24, 2021

Versions

Terraform: 1.0.0
provider: 0.2.0

Affected Resource(s)

  • googleworkspace_schema

Terraform Configuration Files

resource "googleworkspace_schema" "aws_session_duration" {
  schema_name = "Amazon SessionDuration"

  fields {
    field_name       = "SessionDuration"
    field_type       = "INT64"
    multi_valued     = false
    read_access_type = "ADMINS_AND_SELF"
  }
}

Panic Output

Stack trace from the terraform-provider-googleworkspace_v0.2.0_x5 plugin:

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

goroutine 61 [running]:
github.com/hashicorp/terraform-provider-googleworkspace/internal/provider.flattenFields(0xc0006b0160, 0x1, 0x4, 0xe9b3e0, 0xc0004642b0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-googleworkspace/internal/provider/resource_schema.go:400 +0x320
github.com/hashicorp/terraform-provider-googleworkspace/internal/provider.resourceSchemaRead(0x11bf958, 0xc0000ad2c0, 0xc000313f80, 0xf0cd40, 0xc0000ac540, 0xc000299d40, 0xc00064f908, 0x40e0f8)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-googleworkspace/internal/provider/resource_schema.go:237 +0x471
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000319dc0, 0x11bf8e8, 0xc000311c80, 0xc000313f80, 0xf0cd40, 0xc0000ac540, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:347 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000319dc0, 0x11bf8e8, 0xc000311c80, 0xc000392380, 0xf0cd40, 0xc0000ac540, 0xc00000e380, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:624 +0x1cb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00000c078, 0x11bf8e8, 0xc000311c80, 0xc000311cc0, 0xc000311c80, 0x40b965, 0xf90880)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:575 +0x43b
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc0002dfb00, 0x11bf990, 0xc000311c80, 0xc0000ac8a0, 0xc0002dfb00, 0xc0002f4d20, 0xc000430ba0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/server/server.go:298 +0x105
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0xfd7ae0, 0xc0002dfb00, 0x11bf990, 0xc0002f4d20, 0xc0000ac840, 0x0, 0x11bf990, 0xc0002f4d20, 0xc0004fc240, 0x114)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00027e540, 0x11ca878, 0xc0005a8780, 0xc000360480, 0xc000223c80, 0x1723cd0, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1217 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00027e540, 0x11ca878, 0xc0005a8780, 0xc000360480, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1540 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000182510, 0xc00027e540, 0x11ca878, 0xc0005a8780, 0xc000360480)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:878 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:876 +0x1fd

Error: The terraform-provider-googleworkspace_v0.2.0_x5 plugin crashed!

Steps to Reproduce

terraform import googleworkspace_schema.aws_session_duration XXX==, where XXX== is the schema ID which I found with the API Explorer: https://developers.google.com/admin-sdk/directory/reference/rest/v1/schemas/list

@ari-becker
Copy link
Contributor Author

I noticed that the schema_name is supposed to have an underscore in place of the space, so I tried with the underscore and still ran into the issue.

Even with a data resource, I also run into the panic, so it's not specifically an issue with imports:

data "googleworkspace_schema" "aws_session_duration" {
  schema_name = "Amazon_SessionDuration"
}

@megan07 megan07 added the bug Something isn't working label Jun 24, 2021
@megan07 megan07 self-assigned this Jun 24, 2021
@megan07
Copy link
Contributor

megan07 commented Jun 24, 2021

Hi @ari-becker ! I'm sorry you're running into this issue. Unfortunately, I'm unable to reproduce it. Would you be able to provide some debug logs? I'm interested to see what the schema looks like in the response you're getting from the API.
Thanks!

@megan07 megan07 added the waiting-response Waiting for a response label Jun 24, 2021
@ari-becker
Copy link
Contributor Author

Hi @ari-becker ! I'm sorry you're running into this issue. Unfortunately, I'm unable to reproduce it. Would you be able to provide some debug logs? I'm interested to see what the schema looks like in the response you're getting from the API.
Thanks!

It doesn't seem to me that it even is able to send a request to the API endpoint.

plan-debug-sanitized.txt

@megan07
Copy link
Contributor

megan07 commented Jun 29, 2021

Well, this is embarrassing. I forgot to add logging! That's why we're not seeing that request being logged. I'm sorry! I'll add that in here quick! Sorry about that!

@ari-becker
Copy link
Contributor Author

hi @megan07 , will you release a 0.2.1 version with the logging transport?
As I'm trying to run this on Terraform Cloud, I'm not sure how to configure my Terraform project to compile the provider from the main branch in order to run it on Terraform Cloud.

@tejavar
Copy link
Contributor

tejavar commented Jul 1, 2021

Hi @ari-becker !

I'm Tej, a PM for this provider. Firstly, thank you for taking the time to file the issue with us. Megan and the team are working on completing this for our 0.3.0 release ECD 07/06.
Please let us know if you have any concerns regarding our timeline, we would be more than happy to assist you !

Thanks,
Tej

@megan07 megan07 removed the waiting-response Waiting for a response label Jul 1, 2021
@megan07
Copy link
Contributor

megan07 commented Jul 7, 2021

Hi @ari-becker! Sorry for the delay on this. 0.3.0 has now been released. If you wouldn't mind running again and sending the contents of the debug log, I'd love to dive back into this. Thanks! And sorry again!

@ari-becker
Copy link
Contributor Author

Hi @megan07 , enclosed is the debug output from 0.3.0 (with various identifiers sanitized). Thanks for looking into this

plan-debug-sanitized.txt

@megan07
Copy link
Contributor

megan07 commented Jul 8, 2021

@ari-becker thanks for the debug log! i've got a fix in now.

@ari-becker
Copy link
Contributor Author

Hi @megan07 , @tejavar ,

Any news on when 0.3.1 or 0.4.0 will be released, so that I can actually use the fix in #108 ?

@tejavar
Copy link
Contributor

tejavar commented Jul 15, 2021

Hi @ari-becker !
Thanks for reaching out regarding the issue.
I understand your goal is to fix the indexing issue. At the moment we can't guarantee a 0.3.1 due to our competing priorities however, we are working on 0.4.0 and are confident this issue will be addressed in the release. Please note that currently do not have a set date for the 0.4.0 release but aim to complete in the next two weeks.

@megan07
Copy link
Contributor

megan07 commented Jul 27, 2021

Hi @ari-becker, sorry for the delay on this. Wanted to let you know that 0.4 has been released now. Thanks for your patience!

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.

3 participants