PowerBI 3rd party module

Has anyone had success implementing this module?
[powerbi module](GitHub - IgnitionModuleDevelopmentCommunity/powerbi-module: module for "app owns data" method of embedding PowerBI reports)

I have the module installed but am having trouble getting the reportConfig set up properly. I have the necessary information (tenantID, clientID, etc.) and the instructions say to paste the structure as a binding on the reportConfig property, but it doesn't like when I do this. The reportConfig property also has its own structure already, causing us a little more confusion. Any help would be appreciated.

Can anyone who has used this or helped develop it help me with this? The images on the documentation also do not work and give a 404 error when clicking on them.

but it doesn't like when I do this.

Explain this, screenshot this, copy logs, but don't expect help if you don't show anyone the problem.

If you copied and pasted the expression binding, did you set up the view properties it requested?

Apologies, this was just an informal way of saying there was an error. Let me provide more detail. Following the documentation, I added the necessary values to the tenantID, clientID, reportID, workspaceID, and clientSecret properties.

Next, I pasted this expression structure from the documentation as a binding on the reportConfig property:

{
  "type": "expr-struct",
  "config": {
    "struct": {
      "clientID": "{this.props.clientID}",
      "clientSecret": "{this.props.clientSecret}",
      "reportID": "{this.props.reportID}",
      "tenantID": "{this.props.tenantID}",
      "workspaceID": "{this.props.workspaceID}"
    },
    "waitOnAll": true
  },
  "transforms": [
    {
      "code": "\timport urllib\n\t\t\n\ttenantID \u003d value.tenantID\n\tclientID \u003d value.clientID\n\tclientSecret \u003d value.clientSecret\n\tworkspaceID \u003d value.workspaceID\n\treportID \u003d value.reportID\n\t\n\t#Step 1 - get access token\n\turl \u003d \"https://login.microsoftonline.com/\" + tenantID + \"/oauth2/v2.0/token\"\n\t\n\tdata \u003d urllib.urlencode({\n\t\u0027client_secret\u0027: clientSecret,\n\t\u0027grant_type\u0027:\u0027client_credentials\u0027,\n\t\u0027client_id\u0027:clientID,\n\t\u0027scope\u0027:\u0027https://analysis.windows.net/powerbi/api/.default\u0027\n\t})\n\theaders \u003d {\n\t  \u0027Content-Type\u0027: \u0027application/x-www-form-urlencoded\u0027\n\t}\n\t\n\thttp \u003d system.net.httpClient()\n\tresponseStep1 \u003d http.post(url\u003durl, data\u003ddata, headers\u003dheaders)\n\t\n\t#system.perspective.print(responseStep1.json)\n\taccessToken \u003d responseStep1.json[\u0027access_token\u0027]\n\tif not responseStep1.good:\n\t   system.perspective.print(\u0027Error on step 1\u0027)\n\t   \n\t#Step 2 - get embedURL and report details\n\turl \u003d \"https://api.powerbi.com/v1.0/myorg/groups/\" + workspaceID + \"/reports/\" + reportID\n\t\n\theaders \u003d {\n\t  \u0027Authorization\u0027: \u0027Bearer \u0027 + accessToken \n\t}\n\t\n\tresponseStep2 \u003d http.get(url\u003durl, headers\u003dheaders)\n\t#system.perspective.print(responseStep2.json)\n\t\n\t#Step 3 - get embed token and report config\n\turl \u003d \"https://api.powerbi.com/v1.0/myorg/groups/\" + workspaceID + \"/reports/\" + reportID + \"/GenerateToken\"\n\t\n\tdata \u003d {\"accessLevel\": \"View\"}\n\theaders \u003d {\n\t  \u0027Authorization\u0027: \u0027Bearer \u0027 + accessToken,\n\t  \u0027Content-Type\u0027: \u0027application/json\u0027\n\t}\n\t\n\tresponseStep3 \u003d http.post(url\u003durl, data\u003ddata, headers\u003dheaders)\n\t#system.perspective.print(responseStep3.json)\n\t\n\treportPost \u003d {\n\t\t\"Id\": reportID,\n\t\t\"EmbedUrl\": responseStep2.json[\u0027embedUrl\u0027],\n\t\t\"Type\": \"report\",\n\t\t\"EmbedToken\": {\n\t\t\t\"token\": responseStep3.json[\u0027token\u0027],\n\t\t\t\"tokenId\": responseStep3.json[\u0027tokenId\u0027],\n\t\t\t\"expiration\": responseStep3.json[\u0027expiration\u0027]\n\t\t},\n\t\t\"MinutesToExpiration\": 55,\n\t\t\"DefaultPage\": None,\n\t\t\"MobileDefaultPage\": None\n\t\t};\n\t\u0027\u0027\u0027\n\tfor key in reportPost:\n\t\tif type(reportPost[key]) is dict:\n\t\t\tsystem.perspective.print(\"   \" + str(key) + \": \")\n\t\t\tfor item in reportPost[key]:\n\t\t\t\tsystem.perspective.print(\"      \" + str(item) + \": \" + str(reportPost[key][item]))\n\t\telse:\n\t\t\tsystem.perspective.print(\"   \" + str(key) + \": \" + str(reportPost[key]))\n\t\u0027\u0027\u0027\n\treturn reportPost",
      "type": "script"
    }
  ]
}

The first issue I ran into was the binding editor was saying there was a syntax everywhere there was "\u", for example \u0027 or \u003d, in the script that is included in the binding. Strangely enough, this error disappeared when I closed the Designer for the day and came back to it the next day.

But now I am stuck with the Power BI component displaying "Component Error" and can't find any information on why.

My expression structure binding looks like this:

These are a list of errors that display on the web page when I launch the URL and Inspect the component:

  • onerrorLogger: {"stack":"TypeError: lodash_isequal_1.default is not a function
  • Uncaught (in promise) TypeError: lodash_isequal_1.default is not a function
  • TypeError: Cannot read properties of undefined (reading 'token')
  • ui.ErrorBoundary: Component error caught in error boundary

I only noticed these errors but am not really sure what these mean or how to further troubleshoot this.

Updating again, I think the expression structure is valid now. I exported the view and pasted the expression structure provided in the documentation directly into the JSON file and imported this back into the project.

I am having a scripting error with the script provided. Here is some information on this:

Error received:

Traceback (most recent call last):
  File "<input>", line 54, in <module>
KeyError: 'embedUrl'

I also looked into the print statements for troubleshooting. There are 3 steps commented in the script. Step 1's print shows it is returning the

  • token_type
  • access_token
  • ext_expires_in
  • expires_in

Step 2's print statement looks like it is returning an error and appears to be the reason Step 3 fails. The print from Step 2 shows:

{'error': {'code': u'PowerBINotAuthorizedException', 'pbi.error': {'code': u'PowerBINotAuthorizedException', 'exceptionCulprit': 1L, 'details': [], 'parameters': {}}}}

I am assuming now that the configuration is correct and there are some access issues with the IDs that were provided to me, so I plan to look deeper into this and will post back my findings.

for example \u0027 or \u003d

This is just escaping various punctuation, for example \u0027 is '

"Component Error" and can't find any information on why.

I believe you can mouse hover the "i" icon and it tells you more details.

I am assuming now that the configuration is correct and there are some access issues with the IDs that were provided to me, so I plan to look deeper into this and will post back my findings.

This seems to be an accurate assessment, also check both the Gateway Logs and the Client Console for other information.

1 Like