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.