15 Apr 2024 08:00 PM
Hi Team,
I just noticed new errors when loading certain code tiles in my dashboard:
{
"error": {
"code": 540,
"message": "Execution crashed.",
"details": {
"logs": "",
"type": "UNCAUGHT_EXCEPTION",
"message": "Uncaught (in promise) ReferenceError: $Scope is not defined",
"details": {
"sourceLine": " if($Scope[0] === \"Tenant\") {",
"lineNumber": 409,
"startColumn": 3,
"stack": "ReferenceError: $Scope is not defined\n at webApps (file:///script.ts:409:3)\n at getWeightedScore (file:///script.ts:30:23)\n at default (file:///script.ts:1010:33)"
}
}
}
}
The code didn't change and was working for the past year.
I notice that references to the variable "Scope" only fail when located in functions other than the export default async function().
I didn't notice any change in the public documentation.
Could you help me fix that error please?
Solved! Go to Solution.
16 Apr 2024 08:01 AM
Hi @thomas_c
Please create a support ticket via https://one.dynatrace.com/hc/en-us/requests . Tech support will help you with this issue. Please attach the snipped code or the link to the snippet to the ticket.
Best,
Sini
16 Apr 2024 04:50 PM
I discovered that $variable objects cannot be referenced outside of the export default async function() anymore. So, the issue is fixed by passing such object as argument of other functions.
Thanks
23 Apr 2024 09:09 AM
Good morning,
We also encounter the same problem following the last update. Is there a solution. it no longer recognizes the time zone. Thanks for your help
import { problemsClient } from "@dynatrace-sdk/client-classic-environment-v2";
export default async function fetchMetricResults() {
let probS = "";
if($OS == "WINDOWS") probS += "entityTags(\"OS:Windows\"),";
else if ($OS == "LINUX") probS += "entityTags(\"OS:Linux\"),";
if($ManagementZone != "ALL") probS += "managementZones(" + $ManagementZone.toString() + "),";
probS += "status(\"open\")";
const total = await problemsClient.getProblems({
from: Date.parse($dt_timeframe_from).toString(),
to: Date.parse($dt_timeframe_to).toString(),
problemSelector: probS,
pageSize: 1
});
const critical = await problemsClient.getProblems({
from: Date.parse($dt_timeframe_from).toString(),
to: Date.parse($dt_timeframe_to).toString(),
problemSelector: "text(\"CRITICAL\")," + probS,
pageSize: 1
});
const warning = await problemsClient.getProblems({
from: Date.parse($dt_timeframe_from).toString(),
to: Date.parse($dt_timeframe_to).toString(),
problemSelector: "text(\"WARNING\")," + probS,
pageSize: 1
});
return " 🔴 " + total.totalCount
}
23 Apr 2024 09:27 AM
Hi @Dynosaure
As the $dt_timeframe_from and $dt_timeframe_to variables are still used within the export default async function, I wouldn't say it's the same issue/root cause as I described above. And the solution I provided will not solve it.
That's why I believe your situation deserves a whole new thread in the community as it will require a different explanation/solution from Dynatrace R&D teams.
Hope that helps (a tiny bit).