Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
thomashohm
Frequent Visitor

Custom Connector: changing function parameters from optional to required creates dataformat.error

Hello,

 

I have developped a custom connector which works fine - as long as I define my function parameters as optional parameters.

As soon as I change to parameters to required, I get an "Unexpected Exception": "[DataFormat.Error] We found extra characters at the end of JSON input".

 

My Details:

 

Definiton of main function of the custom connector, which works perfectly fine:

 

 

 

 

[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (optional apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =>

 

 

 

 

 

Change the first parameter (or all) to required and the error occurs:

 

 

 

 

[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =>

 

 

 

 

 

The test function which I use for testing the custom connector looks like this:

 

 

 

 

// Use this file to write queries to test your data connector
let
    result = MS_Power_BI_Ungerboeck.Contents("POWBI","ab430fcb-144f-45e1-ab54-447bd22aac5e","d68d7c9f-564e-378f-a14b-b2c0586c68da","https://hostname.mydomain.com/api/v1/Accounts/10?search=AccountCode%20eq'SMITH'",10)
in
    result

 

 

 

 

 

The only change which makes it work or creates the error is to have one or none required parameters:

it works fine when all parameters are declared as optional. 

It fails when at least one parameter is required.

 

I checked lots of examples and documentation about function parameters, but could not find the reason for that.

 

Any help is highly appreaciated.

 

Thank,

Thomas

3 REPLIES 3
Anonymous
Not applicable

Hello, i have the same problem.

 

Did you found a solution?

 

And i have another question, is it possible to change the value of this parameters in Power BI once custom connector is loaded?

 

Thanks in advance.

 

 

thomashohm
Frequent Visitor

Hi Jianbo Li,

 

thanks for your reply.

The error still is the same when I change all parameters to required.

 

Even when I create a new project with the hello world default example and just change the parameter to be mandatory by removing the word "optional", this error occurs. 

 

It might be something completely independant from my own code. 

 

I will accept this situation as not resolvable by myself and leave all parameters as optional. 

 

Thanks anyways for your help.

 

BR

Thomas

v-jianboli-msft
Community Support
Community Support

Hi @thomashohm ,

 

Is the error message the same when you set all parameters to required?

Besides, here’s one of the point provided in the Microsoft documentation

Handling authentication for Power Query connectors - Power Query | Microsoft Learn 

Hope it would help you.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors