Lua http request error in vector lua transformer

71 Views Asked by At

I am using lua http for http request in vector transform, I have installed the lua http using "luarocks intall http".

Lua http and all the dependencies installation was successful without any errors and vector starts without any issue, but the moment I send an event to vector, it's throwing below error

vector::internal_events::lua: Error in building lua script. error=RuntimeErrorHooksProcess { source: RuntimeError("error loading module '_cqueues' from file '/usr/local/lib/lua/5.4/_cqueues.so':\n\tdlopen(/usr/local/lib/lua/5.4/_cqueues.so, 0x0006): symbol not found in flat namespace '_luaL_unref'\nstack traceback:\n\t[C]: in ?\n\t[C]: in ?\n\t[C]: in function 'require'\n\t/usr/local/share/lua/5.4/cqueues/auxlib.lua:2: in function </usr/local/share/lua/5.4/cqueues/auxlib.lua:1>\n\t(...tail calls...)\n\t[C]: in function 'require'\n\t/usr/local/share/lua/5.4/http/client.lua:1: in main chunk\n\t[C]: in function 'require'\n\t/usr/local/share/lua/5.4/http/request.lua:5: in main chunk\n\t[C]: in function 'require'\n\t[string \"src/transforms/lua/v2/mod.rs:231:9\"]:2: in function <[string \"src/transforms/lua/v2/mod.rs:231:9\"]:1>") } error_type="script_failed" error_code="runtime_error_hook_process" stage="processing" internal_log_rate_limit=true

my vector code is:

sources:
  kafka_events:
    type: kafka
    bootstrap_servers: 0.0.0.0:9092
    group_id: test-consumer-group
    topics:
      - test-topic-1

transforms:
  data_enricher:
    type: lua
    inputs:
      - kafka_events
    version: "2"
    hooks:
      process: |-
        function (event, emit)
            local http = require "http.request";
            emit(event)
        end   
    
sinks:
  print:
    type: console
    inputs: 
      - data_enricher
    encoding:
      codec: json

I tried using other http clientLibraries but looks they have their own issues, With httpClient, Request is not getting any response, res.body, res.code etc everything is coming as null. lua-requests has xml dependency which is removed from latest lua version(5.4)

Please help me to resolve _cqueues dependency issue from above error or suggest a good lua http client module for sending http requests.

0

There are 0 best solutions below