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

attempt to call method 'watch' (a nil value) #53

Open
wuchencm opened this issue Feb 22, 2020 · 5 comments
Open

attempt to call method 'watch' (a nil value) #53

wuchencm opened this issue Feb 22, 2020 · 5 comments

Comments

@wuchencm
Copy link

** attempt to call method 'watch' (a nil value)**

@wuchencm
Copy link
Author

** attempt to call method 'watch' (a nil value)**
** attempt to call method 'watchdir' (a nil value)**
the same to watchdir

@membphis
Copy link
Contributor

please take a look at this test case, confirm you are using with right way:

https://github.com/iresty/lua-resty-etcd/blob/5e3037f94d3fd350e7d6ce1d29f93d93edc6d522/t/v3/key.t#L125

if you still have a problem, please provide your mini case.

@wuchencm
Copy link
Author

please take a look at this test case, confirm you are using with right way:

https://github.com/iresty/lua-resty-etcd/blob/5e3037f94d3fd350e7d6ce1d29f93d93edc6d522/t/v3/key.t#L125

if you still have a problem, please provide your mini case.

image

@wuchencm
Copy link
Author

please take a look at this test case, confirm you are using with right way:
https://github.com/iresty/lua-resty-etcd/blob/5e3037f94d3fd350e7d6ce1d29f93d93edc6d522/t/v3/key.t#L125

if you still have a problem, please provide your mini case.

image

`local etcd, err = require("resty.etcd").new({protocol = "v3"})
local body_chunk_fun, err = etcd:watch("/4c",{timeout = 0.5})

if not body_chunk_fun then
ngx.say("failed to watch: ", err)
end

local idx = 0
while true do
local chunk, err = body_chunk_fun()
if not chunk then
if err then
ngx.say(err)
end
break
end
idx = idx + 1
ngx.say(idx, ": ", require("cjson").encode(chunk.result))
end

`

The log:
2020/02/21 22:20:53 [info] 1565#1565: *1127 [lua] v3.lua:502: request_chunk(): http request method: POST path: /v3beta/watch body: {"create_request":{"key":"LzRj"}} query: nil, client: 192.168.0.105, server: localhost, request: "GET /gray HTTP/1.1", host: "192.168.0.107" 2020/02/21 22:20:54 [error] 1565#1565: *1127 lua tcp socket read timed out, client: 192.168.0.105, server: localhost, request: "GET /gray HTTP/1.1", host: "192.168.0.107"

web
1: {"created":true,"header":{"raft_term":"4","cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"18"}} timeout

@membphis
Copy link
Contributor

the error log is info level, we can ignore it.

if you use watch API, you need to confirm your data in etcd is a JSON value.

please take a mini case like this one: https://github.com/iresty/lua-resty-etcd/blob/5e3037f94d3fd350e7d6ce1d29f93d93edc6d522/t/v3/key.t#L125

We do not know what is the value in your etcd. If you need help, please provide an example that can reproduce the problem.

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