Details
-
Bug
-
Resolution: Fixed
-
Critical
-
7.1.0
-
Enterprise Edition 7.1.0 build 2424
-
Untriaged
-
Centos 64-bit
-
1
-
Yes
Description
ISSUE
Due to recent changes in the following patch https://review.couchbase.org/c/couchbase-cli/+/171482 list subcommand of eventing-function-setup CLI function in certain situations is failing with following KeyError.
/opt/couchbase/bin/couchbase-cli eventing-function-setup -c 172.23.106.67 -u Administrator -p password --list |
Traceback (most recent call last):
|
File "/opt/couchbase/lib/python/couchbase-cli", line 22, in <module> |
main()
|
File "/opt/couchbase/lib/python/couchbase-cli", line 17, in main |
cli.execute(args)
|
File "/opt/couchbase/lib/python/cbmgr.py", line 622, in execute |
opts.klass().execute(opts)
|
File "/opt/couchbase/lib/python/cbmgr.py", line 145, in decorator |
return fn(self, opts) |
File "/opt/couchbase/lib/python/cbmgr.py", line 4157, in execute |
self._list(opts)
|
File "/opt/couchbase/lib/python/cbmgr.py", line 4309, in _list |
function_path = self._get_function_path_from_list_functions_endpoint(function)
|
File "/opt/couchbase/lib/python/cbmgr.py", line 4335, in _get_function_path_from_list_functions_endpoint |
if 'function_scope' in function and function['function_scope']['bucket'] != '*': |
KeyError: 'bucket' |
Issue can be reproduced by importing pre Neo eventing function into a Neo cluster and calling the list subcommand (Create eventing handler on 7.0.0 cluster, export it and then import it into a Neo cluster).
api/v/functions returns empty function_scope field for such eventing functions.
curl -XGET -k http://Administrator:password@172.23.106.67:8096/api/v1/functions |
[
|
{
|
"appcode": "function OnUpdate(doc, meta) {\n dst_bucket[meta.id] = doc;\n}\nfunction OnDelete(meta) {\n delete dst_bucket[meta.id];\n}", |
"depcfg": { |
"buckets": [ |
{
|
"alias": "dst_bucket", |
"bucket_name": "dst_bucket", |
"scope_name": "_default", |
"collection_name": "_default", |
"access": "rw" |
}
|
],
|
"source_bucket": "src_bucket", |
"source_scope": "_default", |
"source_collection": "_default", |
"metadata_bucket": "metadata", |
"metadata_scope": "_default", |
"metadata_collection": "_default" |
},
|
"version": "", |
"enforce_schema": false, |
"handleruuid": 1912709298, |
"function_instance_id": "GzQAt1", |
"appname": "Function_396275055_test_export_function", |
"settings": { |
"app_log_max_files": 10, |
"app_log_max_size": 10485760, |
"checkpoint_interval": 10000, |
"cleanup_timers": false, |
"cpp_worker_thread_count": 2, |
"curl_timeout": 500, |
"dcp_stream_boundary": "everything", |
"deadline_timeout": 3, |
"deployment_status": true, |
"description": "", |
"enable_recursive_mutation": false, |
"execution_timeout": 1, |
"fuzz_offset": 0, |
"language_compatibility": "6.6.2", |
"lcb_inst_capacity": 5, |
"log_level": "INFO", |
"processing_status": true, |
"skip_timer_threshold": 86400, |
"sock_batch_size": 100, |
"tick_duration": 60000, |
"timer_processing_tick_interval": 500, |
"vb_ownership_giveup_routine_count": 3, |
"vb_ownership_takeover_routine_count": 3, |
"worker_count": 3, |
"worker_queue_cap": 100000, |
"xattr_doc_timer_entry_prune_threshold": 100 |
},
|
"function_scope": {} |
}
|
]
|
function_scope can be fetched from api/v1/status endpoint in such cases.
curl -XGET -k http://Administrator:password@172.23.106.67:8096/api/v1/status |
{
|
"apps": [ |
{
|
"composite_status": "deployed", |
"name": "Function_396275055_test_export_function", |
"function_scope": { |
"bucket": "*", |
"scope": "*" |
},
|
"num_bootstrapping_nodes": 0, |
"num_deployed_nodes": 1, |
"deployment_status": true, |
"processing_status": true, |
"redeploy_required": false |
}
|
],
|
"num_eventing_nodes": 1 |
}
|