Sorry for the incomplete bug report, I hit send too quickly.
After upgrading from Redis 4 to Redis 5, lua scripts cannot use the cjson
library anymore.
Expected:
$ redis-cli EVAL 'cjson.decode("{}")' 0
(nil)
Actual:
$ redis-cli EVAL 'cjson.decode("{}")' 0
(error) ERR Error running script (call to
f_358b937508335722d5ffc098351582c0fe28e64e): @enable_strict_lua:15:
user_script:1: Script attempted to access nonexistent global variable 'cjson'
The issue seems related to packaging since running the command on the official
Docker image for Redis 5 gives the expected output.
$ dpkg -l | grep lua
ii liblua5.1-0:amd64 5.1.5-8.1+b2 amd64
Shared library for the Lua interpreter version 5.1
ii lua-bitop:amd64 1.0.2-4 amd64
fast bit manipulation library for the Lua language
ii lua-cjson:amd64 2.1.0+dfsg-2 amd64
JSON parser/encoder for Lua
--
Nicolas Le Manchet