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 #227

Open
an15221315127 opened this issue Apr 22, 2022 · 9 comments

Comments

@an15221315127
Copy link

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

goroutine 1 [running]:
github.com/infobloxopen/protoc-gen-gorm/plugin.(*ORMBuilder).followsUpdateConventions(0xc0000671a0, 0xc000828ea0, 0xc000828ea0, {0x13bb7c7, 0x6})
/Users/anguodong/go/pkg/mod/github.com/infobloxopen/[email protected]/plugin/plugin.go:2814 +0x20e
github.com/infobloxopen/protoc-gen-gorm/plugin.(*ORMBuilder).parseServices(0xc0000671a0, 0xc0001be100)
/Users/anguodong/go/pkg/mod/github.com/infobloxopen/[email protected]/plugin/plugin.go:2641 +0x54e
github.com/infobloxopen/protoc-gen-gorm/plugin.(*ORMBuilder).Generate(0xc0000671a0)
/Users/anguodong/go/pkg/mod/github.com/infobloxopen/[email protected]/plugin/plugin.go:282 +0x251
main.main()
/Users/anguodong/go/pkg/mod/github.com/infobloxopen/[email protected]/main.go:33 +0xb0
--gorm_out: protoc-gen-gorm: Plugin failed with status code 2.
make: *** [api] Error 1

@nonaxanon
Copy link

get this issue too for whenever I have an Update prefix and a string id = 1 and other types on the Request

@AFMiziara
Copy link

Same here

@nonaxanon
Copy link

nonaxanon commented Jun 9, 2022

I solved this issue by modifying plugin.go, in line 2811 added several nil checks
Also I upgraded to a new buf builder, 1.4.0
if field == nil || field.Desc == nil || field.Desc.Message() == nil { return false, "", "" } if field.Desc.Message().FullName() == "" { return false, "", "" }

@AFMiziara
Copy link

Thanks for sharing @nonaxanon ! Any chances these changes can be introduced in here?

@saltbo
Copy link

saltbo commented Jul 21, 2022

I solved this issue by modifying plugin.go, in line 2811 added several nil checks Also I upgraded to a new buf builder, 1.4.0 if field == nil || field.Desc == nil || field.Desc.Message() == nil { return false, "", "" } if field.Desc.Message().FullName() == "" { return false, "", "" }

This is not a good resolution.

Doc: Request messages for Create and Update methods should have an Ormable Type in a field named payload

If not the basic Update, should not name UpdateXXX

@gsingh-ds
Copy link

why it requires you to add payload field to update when autogen is not specified?

@C0rWin
Copy link

C0rWin commented Feb 24, 2024

Is this is for Update prefixed APIs? I have create a project (https://github.com/C0rWin/buf-gorm-demo/blob/main/protos/entity.proto) to demonstrate the behavour which leads to the panic and to be honest I am not clear what is the root cause leading to the panic.

PS. Noted that most comments are almost one year old while still facing this issue, hence wondering whenever it was addressed? Or this is an expected and I'm just doing something wrong?

@floating-yuan
Copy link

still facing this issue...

@sansan36
Copy link

I solved this by change every messages named "Update".
for me, I change to "Edit", and everything ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants