Forum Discussion

aplia's avatar
aplia
Frequent Visitor
16 days ago
Solved

User data function invocation failed (but works in testing)

Hi,   I'm having a strange issue where I get the following error, when trying to call a specific UDF from a power bi report: And when I try running the same function as a part of a pipeline,...
  • aplia's avatar
    14 days ago

    After a long stint working with microsoft tech support (big thanks to Naeem), we finally found the source of the issue:

    I had, not knowing better, used the line 

    udf = fn.UserDataFunctions()

    at the beginning of every (publicly visible) function in the document, like this:

    udf = fn.UserDataFunctions()
    
    @udf.connection(argName="sqlDB", alias="COGSdb")
    @udf.function()
    
    async def runAllCogsCalculations(sqlDB: fn.FabricSqlConnection) -> str:

     

    While for some reason this does not cause issues in testing, it leads to all functions defined before the last instance of the line to be unavailable when published, without producing a clear error as to why.

     

    Luckily, the solution is very simple: just remove all but the first use of "udf = fn.UserDataFunctions()" without changing anything else, and the issue should be resolved. 

     

    Hopefully this helps someone who's facing the same issue. I also made sure to report the problem somehow bypassing testing to microsoft, and I hope in the future there will be a proper error to prevent this.