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

Influx1 missing credentials error not handled on write #119

Closed
andig opened this issue May 6, 2020 · 2 comments
Closed

Influx1 missing credentials error not handled on write #119

andig opened this issue May 6, 2020 · 2 comments

Comments

@andig
Copy link
Contributor

andig commented May 6, 2020

Latest since #109 it should be possible to work against Influx1. I've tried to do so, but without credentials (token is empty):

client := influxdb2.NewClientWithOptions(url, token,
	influxdb2.DefaultOptions().SetFlushInterval(1).SetBatchSize(1).SetLogLevel(3),
)
writer := client.WriteApi(org, bucket)

go func() {
	for err := range m.writer.Errors() {
		m.log.ERROR.Println(err)
	}
}()

This does not generate any errror:

2020/05/06 08:47:05 [D]! Write proc: received write request
2020/05/06 08:47:05 [D]! Writing batch: gridPower,loadpoint=openwb-lp1 value=-5208 1588747625681549000
2020/05/06 08:47:05 [D]! Write proc: received write request
2020/05/06 08:47:05 [D]! Writing batch: pvPower,loadpoint=openwb-lp1 value=-6596 1588747625681587000
2020/05/06 08:47:05 [I]! sending batch
2020/05/06 08:47:05 [D]! Write proc: received write request
2020/05/06 08:47:05 [D]! Writing batch: chargePower,loadpoint=openwb-lp1 value=0 1588747625681638000
2020/05/06 08:47:05 [I]! sending batch

I would have expected an error value even with the async writer as points cannot be written. I did not check if this is handled correctly with Influx2.

Update using a blocking writer doesn't error either:

	if err := m.writer.WritePoint(context.Background(), p); err != nil {
		m.log.ERROR.Println(err)
	}
@vlastahajek
Copy link
Contributor

It looks like your InfuxDB 1 instance is unauthenticated and writes go OK.
If InfluxDB 1 had authentication turned on, you would see an error, despite with an empty message, cause InfluxDB 1 sends error in an incompatible format.

@andig
Copy link
Contributor Author

andig commented May 6, 2020

thank you- guess I need to double-check :/

@andig andig closed this as completed May 6, 2020
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

2 participants