apache / openwhisk-apigateway

Apache OpenWhisk API Gateway service for exposing actions as REST interfaces.
https://openwhisk.apache.org/
Apache License 2.0
64 stars 45 forks source link

wsk api should create an API and successfully invoke that API FAILED #342

Closed rabbah closed 5 years ago

rabbah commented 5 years ago

Per the dev list, the commit from #335 is suspected of breaking the build. Here's a log from the apigw container when running the test:

==> /var/log/api-gateway/access.log <==
172.17.0.1 - remote_user="-" [28/May/2019:18:18:26 +0000] request_method="GET" request_uri="/v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp" request_protocol="HTTP/1.1" status=500 bbs=199 rl=407 rt=0.002 hr="-" ua="OpenWhisk-apimgmt/1.0.0 akka-http/10.1.8 akka-http/10.1.8 akka-http/10.1.8" xfwdf="-"
172.17.0.1 - remote_user="-" [28/May/2019:18:18:27 +0000] request_method="GET" request_uri="/v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp" request_protocol="HTTP/1.1" status=500 bbs=199 rl=390 rt=0.001 hr="-" ua="OpenWhisk-apimgmt/1.0.0 akka-http/10.1.8 akka-http/10.1.8" xfwdf="-"
172.17.0.1 - remote_user="-" [28/May/2019:18:18:27 +0000] request_method="GET" request_uri="/v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp" request_protocol="HTTP/1.1" status=500 bbs=199 rl=424 rt=0.002 hr="-" ua="OpenWhisk-apimgmt/1.0.0 akka-http/10.1.8 akka-http/10.1.8 akka-http/10.1.8 akka-http/10.1.8" xfwdf="-"

==> /var/log/api-gateway/management.log <==
2019/05/28 18:18:26 [error] 36#0: *18 lua entry thread aborted: runtime error: /etc/api-gateway/scripts/lua/management/lib/tenants.lua:130: attempt to compare nil with number
stack traceback:
coroutine 0:
    /etc/api-gateway/scripts/lua/management/lib/tenants.lua: in function 'getTenantAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:62: in function 'getAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:41: in function 'requestHandler'
    access_by_lua(management_apis.conf:36):5: in function <access_by_lua(management_apis.conf:36):1>, client: 172.17.0.1, server: management_gw, request: "GET /v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp HTTP/1.1", host: "172.17.0.1:9000"
2019/05/28 18:18:27 [error] 36#0: *20 lua entry thread aborted: runtime error: /etc/api-gateway/scripts/lua/management/lib/tenants.lua:130: attempt to compare nil with number
stack traceback:
coroutine 0:
    /etc/api-gateway/scripts/lua/management/lib/tenants.lua: in function 'getTenantAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:62: in function 'getAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:41: in function 'requestHandler'
    access_by_lua(management_apis.conf:36):5: in function <access_by_lua(management_apis.conf:36):1>, client: 172.17.0.1, server: management_gw, request: "GET /v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp HTTP/1.1", host: "172.17.0.1:9000"
2019/05/28 18:18:27 [error] 36#0: *22 lua entry thread aborted: runtime error: /etc/api-gateway/scripts/lua/management/lib/tenants.lua:130: attempt to compare nil with number
stack traceback:
coroutine 0:
    /etc/api-gateway/scripts/lua/management/lib/tenants.lua: in function 'getTenantAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:62: in function 'getAPIs'
    /etc/api-gateway/scripts/lua/management/routes/apis.lua:41: in function 'requestHandler'
    access_by_lua(management_apis.conf:36):5: in function <access_by_lua(management_apis.conf:36):1>, client: 172.17.0.1, server: management_gw, request: "GET /v2/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/apis?limit=undefined&skip=undefined&basePath=%2FAPIGW_HEALTHTEST1_bp HTTP/1.1", host: "172.17.0.1:9000"
2019/05/28 18:18:31 Executing sync cmd: echo ''
2019/05/28 18:18:31 done
2019/05/28 18:18:41 Executing sync cmd: echo ''
sync stdout | ''
2019/05/28 18:18:41 done

with the error tenants.lua:130: attempt to compare nil with number emitted multiple times. I'm not sure if that's the root cause.

The implicated lines: https://github.com/apache/incubator-openwhisk-apigateway/blob/1f46de9d2f7a9420e48c533af7a4b1b6118aa130/scripts/lua/management/lib/tenants.lua#L129-L130

rabbah commented 5 years ago

the value of limit (and skip) are the string "undefined" and that's why the predicate fails at runtime --- the guards check against nil earlier.

dgrove-oss commented 5 years ago

Fix merged.