Unable to build custom beat

I am trying to follow the instructions building the countbeat example here on Ubuntu 18.04 but am not having much luck. After figuring out that the mage instructions are wrong, I was able to get past that by building it from the github.com/elastic/beats directory (not the new beat directory as it states) but it still errors out with the following:

mage GenerateCustomBeat
Enter the beat name [examplebeat]: countbeat
Enter your github name [your-github-name]: punisherVX
Enter the beat path [github.com/punisherVX/countbeat]:
Enter your full name [Firstname Lastname]: James Cameron
Enter the beat type [beat]:
Enter the github.com/elastic/beats revision [master]:
go: creating new go.mod: module github.com/punisherVX/countbeat
go: finding module for package github.com/elastic/beats/v7/libbeat/logp
go: finding module for package github.com/elastic/beats/v7/libbeat/cmd/instance
go: finding module for package github.com/elastic/beats/v7/dev-tools/mage/target/build
go: finding module for package github.com/magefile/mage/sh
go: finding module for package github.com/elastic/beats/v7/libbeat/beat
go: finding module for package github.com/elastic/beats/v7/dev-tools/mage
go: finding module for package github.com/elastic/beats/v7/libbeat/common
go: finding module for package github.com/elastic/beats/v7/libbeat/cmd
go: finding module for package github.com/magefile/mage/mg
go: finding module for package github.com/elastic/beats/v7/dev-tools/mage/target/common
go: finding module for package github.com/elastic/beats/v7/dev-tools/mage/target/unittest
go: finding module for package github.com/elastic/beats/v7/dev-tools/mage/target/pkg
go: finding module for package github.com/reviewdog/reviewdog/cmd/reviewdog
go: finding module for package github.com/tsg/go-daemon
go: finding module for package golang.org/x/lint/golint
go: finding module for package github.com/pierrre/gotestcover
go: finding module for package github.com/mitchellh/gox
go: found github.com/elastic/beats/v7/dev-tools/mage in github.com/elastic/beats/v7 v7.8.1
go: found github.com/magefile/mage/mg in github.com/magefile/mage v1.10.0
go: found github.com/mitchellh/gox in github.com/mitchellh/gox v1.0.1
go: found github.com/pierrre/gotestcover in github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0
go: found github.com/reviewdog/reviewdog/cmd/reviewdog in github.com/reviewdog/reviewdog v0.10.2
go: found github.com/tsg/go-daemon in github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b
go: found golang.org/x/lint/golint in golang.org/x/lint v0.0.0-20200302205851-738671d3881b
go: found golang.org/x/tools/cmd/goimports in golang.org/x/tools v0.0.0-00010101000000-000000000000
go: github.com/elastic/beats/v7 master => v7.0.0-alpha2.0.20200813135828-a6d98d69beea
go: github.com/mattn/go-colorable upgrade => v0.1.7
go: github.com/pkg/errors upgrade => v0.9.1
go: github.com/mitchellh/hashstructure upgrade => v1.0.0
go: go.uber.org/multierr upgrade => v1.5.0
go: github.com/rcrowley/go-metrics upgrade => v0.0.0-20200313005456-10cdbea86bc0
go: github.com/hashicorp/go-multierror upgrade => v1.1.0
go: github.com/mattn/go-isatty upgrade => v0.0.12
go: golang.org/x/sys upgrade => v0.0.0-20200812155832-6a926be9bd1d
go: golang.org/x/net upgrade => v0.0.0-20200813134508-3edf25e44fcc
go: golang.org/x/tools upgrade => v0.0.0-20200812231640-9176cd30088c
go: honnef.co/go/tools upgrade => v0.0.1-2020.1.5
go: golang.org/x/lint upgrade => v0.0.0-20200302205851-738671d3881b
go: gopkg.in/yaml.v2 upgrade => v2.3.0
go: github.com/elastic/go-sysinfo upgrade => v1.4.0
go: github.com/magefile/mage upgrade => v1.10.0
go: github.com/go-sourcemap/sourcemap upgrade => v2.1.3+incompatible
go: golang.org/x/text upgrade => v0.3.3
go: github.com/fatih/color upgrade => v1.9.0
go: github.com/prometheus/procfs upgrade => v0.1.3
go: github.com/hashicorp/errwrap upgrade => v1.0.0
go: go.uber.org/atomic upgrade => v1.6.0
go: github.com/akavel/rsrc upgrade => v0.9.0
go: github.com/dlclark/regexp2 upgrade => v1.2.0
go: go.elastic.co/fastjson upgrade => v1.1.0
go: go.elastic.co/apm upgrade => v1.8.0
go: go.uber.org/zap upgrade => v1.15.0
go: golang.org/x/crypto upgrade => v0.0.0-20200728195943-123391ffb6de
go: github.com/jstemmer/go-junit-report upgrade => v0.9.1
go: github.com/josephspurrier/goversioninfo upgrade => v1.2.0
go: github.com/dop251/goja_nodejs upgrade => v0.0.0-20200811150831-9bc458b4bbeb
go: github.com/elastic/go-ucfg upgrade => v0.8.3
go: github.com/elastic/go-windows upgrade => v1.0.1
go: go.elastic.co/ecszap upgrade => v0.2.0
go: github.com/dop251/goja upgrade => v0.0.0-20200811154920-cd0eddb06559
go: howett.net/plist upgrade => v0.0.0-20200419221736-3b63eb3a43b5
# github.com/dop251/goja_nodejs/require
../../../../pkg/mod/github.com/dop251/goja_nodejs@v0.0.0-20200811150831-9bc458b4bbeb/require/resolve.go:169:13: undefined: goja.StackFrame
../../../../pkg/mod/github.com/dop251/goja_nodejs@v0.0.0-20200811150831-9bc458b4bbeb/require/resolve.go:170:21: r.runtime.CaptureCallStack undefined (t
ype *goja.Runtime has no field or method CaptureCallStack)
Error: error compiling magefiles
make: *** [fields] Error 1
Error: running "make update" failed with exit code 2

I have tried searching on the goja.runtime error with zero hits, so I am not sure how to fix this.

Go version:

go version go1.14.7 linux/amd64


This is issue has just gotten fixed on master: https://github.com/elastic/beats/pull/20586

Let me know if you still have issues when generating a new Beat.

Thanks, that fixed it.
The next step is broken tho - it shouldn't be "make setup" but rather "make update"
I will figure out how to submit a PR for that.

Just tried this with the 7.9 branch and it is still broken. It works in master though. According to the pull merge it was put into 7.9?

Yes, it is part of 7.9. Could you please share the error you are getting again?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.