You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/07/01 03:24:43 UTC

[GitHub] [openwhisk-apigateway] jiangpengcheng opened a new issue #376: error: Unable to create API: API creation failure: Unable to configure the API Gateway (status code 500):

jiangpengcheng opened a new issue #376:
URL: https://github.com/apache/openwhisk-apigateway/issues/376


   ## Error
   
   can not create api
   
   ## Step to reproduce
   
   1. create an api:
   
   ```shell
   wsk -i api create /root /path get hello
   ```
   
   2.  get the api url and invoke it
   
   ```shell
   # ~ wsk -i api list
   ok: APIs
   Action                 Verb  API Name  URL
   /whisk.system/hello     get     /root  http://172.17.0.1:9001/api/789c46b1-71f6-4ed5-8c54-816aa4f8c502/root/path
   
   # ~ curl http://172.17.0.1:9001/api/789c46b1-71f6-4ed5-8c54-816aa4f8c502/root/path
   {
   
   }
   ```
   
   3. then create a second api, this will be failed
   
   ```shell
   # ~ wsk -i api create /root /path2 get hello
   error: Unable to create API: API creation failure: Unable to configure the API Gateway (status code 500): "<html>\r\n<head><title>500 Internal Server Error</title></head>\r\n<body>\r\n<center><h1>500 Internal Server Error</h1></center>\r\n<hr><center>openresty/1.15.8.3</center>\r\n</body>\r\n</html>\r\n"
   ```
   
   ## Reason
   
   the `apigateway` container complains about an error:
   
   ```shell
   ==> /var/log/api-gateway/management.log <==
   2020/07/01 03:15:21 [error] 56#0: *65 lua entry thread aborted: runtime error: /etc/api-gateway/scripts/lua/routing.lua:250: bad argument #1 to 'pairs' (table expected, got nil)
   stack traceback:
   coroutine 0:
   	[C]: in function 'pairs'
   	/etc/api-gateway/scripts/lua/routing.lua:250: in function 'parsePolicies'
   	/etc/api-gateway/scripts/lua/management/lib/swagger.lua:28: in function 'parseSwagger'
   	/etc/api-gateway/scripts/lua/management/routes/apis.lua:123: in function 'addAPI'
   	/etc/api-gateway/scripts/lua/management/routes/apis.lua:43: in function 'requestHandler'
   	access_by_lua(management_apis.conf:36):5: in main chunk, client: 172.17.0.1, server: management_gw, request: "PUT /v2/789c46b1-71f6-4ed5-8c54-816aa4f8c502/apis/5bba0e4c-c700-4c32-ba57-1e857584e9d9 HTTP/1.1", host: "172.17.0.1:9000"
   ```
   
   and after look through codes and debugging, it seems that in second and subsequent api creation, the method `scripts/lua/management/lib/swagger.lua#parseSwagger` which should call method `scripts/lua/management/lib/swagger.lua#parsePolicies` but actually it's called `scripts/lua/routing.lua#parsePolicies`
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-apigateway] style95 closed issue #376: error: Unable to create API: API creation failure: Unable to configure the API Gateway (status code 500):

Posted by GitBox <gi...@apache.org>.
style95 closed issue #376:
URL: https://github.com/apache/openwhisk-apigateway/issues/376


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-apigateway] jiangpengcheng commented on issue #376: error: Unable to create API: API creation failure: Unable to configure the API Gateway (status code 500):

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on issue #376:
URL: https://github.com/apache/openwhisk-apigateway/issues/376#issuecomment-652167153


   although I didn't know the real reason why there is conflict, but seems it is imported by openrestry upgrade: #374 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org