adobe-apiplatform / api-gateway-aws

AWS SDK for NGINX with Lua
Apache License 2.0
171 stars 44 forks source link

api-gateway.cache.cache cannot be found #20

Closed mrgonza78 closed 7 years ago

mrgonza78 commented 7 years ago

after I install it with luarocks

luarocks install lua-api-gateway-aws

when I require the rock

content_by_lua_block { require('api-gateway.aws.AwsService') }

I get this error b/c 'api-gateway.cache.cache' cannot be found:

ERROR: ...ajit/share/lua/5.1/api-gateway/aws/AWSIAMCredentials.lua:13: module 'api-gateway.cache.cache' not found:
    no field package.preload['api-gateway.cache.cache']
    no file '/usr/local/openresty/lualib/api-gateway/cache/cache.lua'
    no file '/usr/local/openresty/lualib/api-gateway/cache/cache/init.lua'
    no file './api-gateway/cache/cache.lua'
    no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/api-gateway/cache/cache.lua'
    no file '/usr/local/share/lua/5.1/api-gateway/cache/cache.lua'
    no file '/usr/local/share/lua/5.1/api-gateway/cache/cache/init.lua'
    no file '/usr/local/openresty/luajit/share/lua/5.1/api-gateway/cache/cache.lua'
    no file '/usr/local/openresty/luajit/share/lua/5.1/api-gateway/cache/cache/init.lua'
    no file '/usr/local/openresty/lualib/api-gateway/cache/cache.so'
    no file './api-gateway/cache/cache.so'
    no file '/usr/local/lib/lua/5.1/api-gateway/cache/cache.so'
    no file '/usr/local/openresty/luajit/lib/lua/5.1/api-gateway/cache/cache.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file '/usr/local/openresty/lualib/api-gateway.so'
    no file './api-gateway.so'
    no file '/usr/local/lib/lua/5.1/api-gateway.so'
    no file '/usr/local/openresty/luajit/lib/lua/5.1/api-gateway.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'

Lua package path is correctly set b/c it can find any other lib installed by luarocks.

What I noticed is that 'api-gateway.cache.cache' is not installed in the expected luarock location:

/usr/local/share/lua/5.1/api-gateway/cache/cache.lua

but in a 'lua' folder in the luarock location:

/usr/local/share/lua/5.1/lua/api-gateway/cache/cache.lua

Any reason api-gateway-cachemanager is installing the code in lua/api-gateway vs just api-gateway

If that can't be changed, I'd suggest to change all require('api-gateway.cache.xxxx') to require('lua.api-gateway.cache.xxxx') (here and here for instance)

If that can't be changed either I'd suggest some sort of installation instruction that indicates that /your-luarocks-location/lua has to be added to the package path

Happy to answer any question about this issue since I can reproduce it.

Thanks

ddragosd commented 7 years ago

@mrgonza78 you're right. The luarock spec for the cache manager has this issue - https://github.com/adobe-apiplatform/api-gateway-cachemanager/pull/9/files

I'll fix it so that no code changes are required.

ddragosd commented 7 years ago

@mrgonza78 I've uploaded a newer version of lua-api-gateway-cachemanager module. Mind giving it another try ?

mrgonza78 commented 7 years ago

worked! Thanks a lot for the prompt handling of this

ddragosd commented 7 years ago

@mrgonza78 appreciate your support and thanks a lot for validating it.

kat-takahashi710 commented 5 years ago

Could you add api-gateway-cachemanager to the README.md dependent module?