I recently tried to use this package to resolve the SRV record but in my local Lua file I was unable to import this package as it always throws this error saying
lua: /usr/local/share/lua/5.3/resty/dns/utils.lua:18: attempt to index a nil value (global 'ngx')
stack traceback:
/usr/local/share/lua/5.3/resty/dns/utils.lua:18: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.3/resty/dns/client.lua:23: in main chunk
[C]: in function 'require'
dns_resolver.lua:1: in main chunk
[C]: in ?
Hi @Rezwanul-Haque! Yes, this package is meant to be used when embedding Lua code in Nginx using lua-nginx-module, you can't use it in a standalone script. Please, refer to OpenResty docs to learn more.
I recently tried to use this package to resolve the SRV record but in my local Lua file I was unable to import this package as it always throws this error saying