Open an15221315127 opened 2 years ago
get this issue too for whenever I have an Update prefix and a string id = 1 and other types on the Request
Same here
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, "", "" }
Thanks for sharing @nonaxanon ! Any chances these changes can be introduced in here?
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
why it requires you to add payload field to update when autogen is not specified?
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?
still facing this issue...
I solved this by change every messages named "Update". for me, I change to "Edit", and everything ok
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/protoc-gen-gorm@v1.1.0/plugin/plugin.go:2814 +0x20e github.com/infobloxopen/protoc-gen-gorm/plugin.(ORMBuilder).parseServices(0xc0000671a0, 0xc0001be100) /Users/anguodong/go/pkg/mod/github.com/infobloxopen/protoc-gen-gorm@v1.1.0/plugin/plugin.go:2641 +0x54e github.com/infobloxopen/protoc-gen-gorm/plugin.(*ORMBuilder).Generate(0xc0000671a0) /Users/anguodong/go/pkg/mod/github.com/infobloxopen/protoc-gen-gorm@v1.1.0/plugin/plugin.go:282 +0x251 main.main() /Users/anguodong/go/pkg/mod/github.com/infobloxopen/protoc-gen-gorm@v1.1.0/main.go:33 +0xb0 --gorm_out: protoc-gen-gorm: Plugin failed with status code 2. make: *** [api] Error 1