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

Missing required field: events #35

Open
moubry opened this issue Sep 8, 2022 · 1 comment
Open

Missing required field: events #35

moubry opened this issue Sep 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@moubry
Copy link

moubry commented Sep 8, 2022

I'm trying to implement a simple Hello World and am getting an error saying I'm missing the events field.

Code:

ampConfig := amplitude.NewConfig(os.Getenv("AMPLITUDE_API_KEY"))
ampConfig.FlushInterval = 1 * time.Second
amp := amplitude.NewClient(ampConfig)
amp.Track(amplitude.Event{
	EventType:    "Button Clicked 2",
	EventOptions: amplitude.EventOptions{UserID: "test_user"},
})
amp.Flush()

Logs (with some custom logging):

[00] amplitude-analytics2022/09/08 09:55:25 Debug: Message received from messageChannel: %!(EXTRA amplitude.message={0x1400001c240 <nil>}, *amplitude.Event=&{Button Clicked 2 {test_user  1662648925051 2f60c081-e49b-4601-b91a-a9578dbc1faa amplitude-go/0.0.2 0 0                    0 0 0   0 0  {}} map[] map[] map[] map[]})
[00] amplitude-analytics2022/09/08 09:55:25 Debug: Message received from messageChannel: %!(EXTRA amplitude.message={<nil> 0x140001ceea0}, *amplitude.Event=<nil>)
[00] amplitude-analytics2022/09/08 09:55:25 Debug: Sending event(s) to Amplitude: %!(EXTRA string={"api_key":"19c9...","Events":[{"event_type":"Button Clicked 2","user_id":"test_user","time":1662648925051,"insert_id":"2f60c081-e49b-4601-b91a-a9578dbc1faa","library":"amplitude-go/0.0.2","plan":{}}]})
[00] amplitude-analytics2022/09/08 09:55:25 Error: HTTP request failed with 400 status%!(EXTRA string={"missing_field":"events","code":400,"error":"Request missing required field"}

The request clearly has an Events field. I’m not sure what I’m doing wrong here.

@moubry moubry added the bug Something isn't working label Sep 8, 2022
@falconandy
Copy link
Contributor

Hi @moubry
Could you please try version v0.0.3? The code snippet works for me.

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

No branches or pull requests

2 participants