Facing problem in udf module not found

Hi,

When i run aggregate function then I found error. I am using Nodejs client. So How to set systempath and userpath in aerospike.

Sep 28 2018 07:07:18 GMT: ERROR(24809) [mod_lua.c:577] [create_state] - Lua Create Error: module '/home/amangarg/Documents/aerospike/udf/feedback.lua' not found:
	no field package.preload['/home/amangarg/Documents/aerospike/udf/feedback.lua']
	no file './/home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/share/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/share/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua/init.lua'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua/init.lua'
	no file '//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file './/home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file '//home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file './/home/amangarg/Documents/aerospike/udf/feedback.so'
	no file
Sep 28 2018 07:07:18 GMT: ERROR(24809) [mod_lua.c:577] [create_state] - Lua Create Error: module '/home/amangarg/Documents/aerospike/udf/feedback.lua' not found:
	no field package.preload['/home/amangarg/Documents/aerospike/udf/feedback.lua']
	no file './/home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/share/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/share/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua/init.lua'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua/init.lua'
	no file '//home/amangarg/Documents/aerospike/udf/feedback/lua.lua'
	no file './/home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file '/usr/local/lib/lua/5.1//home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file '//home/amangarg/Documents/aerospike/udf/feedback/lua.so'
	no file './/home/amangarg/Documents/aerospike/udf/feedback.so

On the client side you should set userPath to the directory where the UDF file resides. In your example it looks like that would be

'/home/amangarg/Documents/aerospike/udf'

Also, when you run the aggregation, refer to the simple UDF module name and not the full path, so for example:

client.apply('feedback', ...)

This doc page might be helpful if you have not seen it:

https://www.aerospike.com/docs/client/nodejs/usage/query/aggregate.html

1 Like