Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
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.
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
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
2 |