DUCKDB – WASM Scalar UDF with Utf-8 return type returning null values always

In my project, I am utilizing duckdb wasm. I encountered a need for a custom user-defined function (UDF), so I created one with a return type of UTF-8. However, it consistently returns u0000.


 // Test udf
    function stringTest(a) {
      try {
        return a + "hello";
      }catch(ex){
        console.log(ex)
      }
    }

    conn.createScalarFunction('stringTest', new arrow.Utf8, stringTest);
Code for element print log

    const result = await conn.query(`SELECT * FROM '${tableName}'`);
        console.log('result: ', result);
        // Get columns and rows
        const columns = result.schema.fields.map(field => field.name);
        let rows = result.toArray();
      
        
        console.log('columns: ', columns);
        
      
        rows.forEach(item => console.log(item));

Image of dubugged value in browser

https://i.sstatic.net/6c9CZGBM.png

There are many use cases involving string return types. Can you please assist me with this problem?