Golang runtime panic when using gaction on Linux t

2019-07-10 16:15发布

I am trying to build my first Google Home app using the instructions in this tutorial, on a Linux 14.04 LTS box (not Windows):

https://medium.com/google-cloud/building-your-first-action-for-google-home-in-30-minutes-ec6c65b7bd32

The deployment of my app to Google Cloud succeeds. However, when I get to the section where you test your app with the simulator, the following gactions commands fail with the message "No help topic for preview/simulate"

$ gactions preview --action_package action.json --invocation_name "three doors" --preview_mins 1234

No help topic for 'preview'

And:

$ gactions simulate

No help topic for 'simulate'

I then tried switching to the Google Actions instructions for the simulator here:

https://developers.google.com/actions/tools/simulator

That document instructs me to use the following command to upload my Actions project:

$ gactions update --action_package action.json --project three-doors-9898

But that leads to a Golang panic crash with the following stack trace:

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

goroutine 1 [running]:
github.com/urfave/cli.HandleAction.func1(0xc4200fd208)
    /usr/local/google/home/gkal/code/go/src/github.com/urfave/cli/app.go:478 +0x27a
panic(0x737b00, 0x960720)
    /usr/lib/google-golang/src/runtime/panic.go:491 +0x283
github.com/Jeffail/gabs.(*Container).Bytes(0x0, 0x0, 0x0, 0x3000100)
    /usr/local/google/home/gkal/code/go/src/github.com/Jeffail/gabs/gabs.go:459 +0x26
github.com/Jeffail/gabs.(*Container).String(0x0, 0xc420123350, 0x793672)
    /usr/local/google/home/gkal/code/go/src/github.com/Jeffail/gabs/gabs.go:483 +0x2b
main.getLocaleFromActionPackage(0xc4203a60a0, 0xb, 0xc4203a60a0)
    /usr/local/google/home/gkal/code/go/src/github.com/gkaldevrel/cli/gactions/gactions.go:605 +0xdf
main.commandUpdate.func1(0xc42008cf00)
    /usr/local/google/home/gkal/code/go/src/github.com/gkaldevrel/cli/gactions/gactions.go:726 +0x209
reflect.Value.call(0x717fa0, 0x7a9988, 0x13, 0x793011, 0x4, 0xc4200fd1c8, 0x1, 0x1, 0xc4200fd150, 0x788860, ...)
    /usr/lib/google-golang/src/reflect/value.go:434 +0x906
reflect.Value.Call(0x717fa0, 0x7a9988, 0x13, 0xc4200fd1c8, 0x1, 0x1, 0x614896, 0x7930f1, 0x4)
    /usr/lib/google-golang/src/reflect/value.go:302 +0xa4
github.com/urfave/cli.HandleAction(0x717fa0, 0x7a9988, 0xc42008cf00, 0x0, 0x0)
    /usr/local/google/home/gkal/code/go/src/github.com/urfave/cli/app.go:487 +0x17a
github.com/urfave/cli.Command.Run(0x793732, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7a4928, 0x4b, 0x0, ...)
    /usr/local/google/home/gkal/code/go/src/github.com/urfave/cli/command.go:191 +0x9fd
github.com/urfave/cli.(*App).Run(0xc420001080, 0xc42000e0c0, 0x6, 0x6, 0x0, 0x0)
    /usr/local/google/home/gkal/code/go/src/github.com/urfave/cli/app.go:240 +0x57d
github.com/urfave/cli.(*App).RunAndExitOnError(0xc420001080)
    /usr/local/google/home/gkal/code/go/src/github.com/urfave/cli/app.go:257 +0x53
main.main()
    /usr/local/google/home/gkal/code/go/src/github.com/gkaldevrel/cli/gactions/gactions.go:157 +0xa02

Below is my package file (action.json), which I did validate with a JSON validator:

{
    "versionLabel": "1.0",
    "agentInfo": {
        "languageCode": "en-US",
        "projectId": "three-doors-9898",
        "voiceName": "male_1"
    },
    "actions": [{
        "description": "Launch intent",
        "initialTrigger": {
            "intent": "assistant.intent.action.MAIN"
        },
        "httpExecution": {
            "url": "https://us-central1-three-doors-9898.cloudfunctions.net/three_doors"
        }
    }]
}

How can I fix this and get my Google Home/Assistant app working?

UPDATE: The version of gactions I am using came from here:

I used the Linux/x86_64 link on this page to get it:

https://developers.google.com/actions/tools/gactions-cli .

Is it possible that's the wrong version for my system? I'm running Ubuntu 14.04 LTS, 64-bit version.

2条回答
在下西门庆
2楼-- · 2019-07-10 16:43

There is a new gactions version available. Try gactions selfupdate.

If that's not working because the version is broken, download the old version and run it. This old version then updates to 2.1.1 and everything works again.

查看更多
地球回转人心会变
3楼-- · 2019-07-10 16:46

My surmise is that github.com/gkaldevrel/cli/gactions/gactions.go:605 is calling .String() on a nil pointer to gabs.Container

The github.com/gkaldevrel/cli package doesn't seem to be public, so I can't tell for sure, but tracing through the stack trace and extrapolating from the different version of gabs.go at https://github.com/Jeffail/gabs/blob/master/gabs.go, it appears the gabs.Container has a func (g *Container) Bytes method that is trying to dereference g and is panicing because it's nil.

查看更多
登录 后发表回答