Error trying to edit dashboard

I created a new dashboard called, No Offers DB. Trying to save the code caused errors on the page.
The original dashboard I was building was:

New-UDDashboard -Title " No Offers Count" -Content  {
    New-UDCard -Title 'Count' -Content {
        New-UDChart -Type Line -AutoRefresh -RefreshInterval 60 -Endpoint {
            $sqlQuery = @"
            SELECT DISTINCT Date_Time, SUM([count])
            FROM tblNoOffers
            WHERE Date_Time >= DATEADD(HOUR, -4, GETDATE())
            GROUP BY Date_Time
            "@
            $cache:rpt_Report = Invoke-Sqlcmd -ServerInstance sql-server -Database Monitoring -Query $sqlQuery
            $cache:rpt_Report | Out-UDChartData -LabelProperty 'Date_Time' -Dataset @(
                New-UDChartDataset -DataProperty 'Count' -label 'Count' -BackgroundColor = "" -BorderColor '#797596'
            )
        }
    }
}
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data


d@http://server:5000/admin/static/js/83.7c4af733.chunk.js:1:556
```

```
Product: PowerShell Universal
Version: 2.0.0
```

Can you send me a screenshot of the error? I just want to see how it is nested in the UI. This error can happen when a session times out and you attempt to interact with the admin console (it’s fixed in the current branch and will be released in 2.0.3). The other thing I’d be interested in is if you see this error on other pages after you see it on the dashboard page.

Hey @adam

I had just logged in, so I am not sure how my session timed out, though possible. What is weird, is I was using my desktop to edit the script this morning, no error. Until I started trying to fix the whitespace on the variable and then restart the dashboard, then I got the above error again. This happens on all tabs in the current dashboard I am editing. Here is a screenshot:

Ah ok. Probably not the issue with the session time out.

Can you do me one more favor and press F12 in your browser? There should be an error in the console tab and it may have a better stack trace since it should load the map file.

Sure thing.
So I had gone and checked to see if the error appeared for other dashboards, it was not.
I went back to the dashboard with the error and no error. I did was I was doing earlier, fixed some code and restarted the dashboard and this time got a different error:

Error: Minified React error #31

Here is the F12 Console Log

[2021-06-09T13:23:50.812Z] Information: Normalizing '/notificationhub' to 'http://server:5000/notificationhub'. Utils.ts:188:39
[2021-06-09T13:23:50.813Z] Debug: Starting HubConnection. Utils.ts:192:39
[2021-06-09T13:23:50.813Z] Debug: Starting connection with transfer format 'Text'. Utils.ts:192:39
[2021-06-09T13:23:50.814Z] Debug: Sending negotiation request: http://server:5000/notificationhub/negotiate?negotiateVersion=1. Utils.ts:192:39
Insertion point 'inject-styles-here' does not exist. Be sure to add comment on head and that it matches the insertionPoint 3 index.tsx:54:10
Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.
admin
[2021-06-09T13:23:50.863Z] Debug: Selecting transport 'WebSockets'. Utils.ts:192:39
[2021-06-09T13:23:50.992Z] Information: WebSocket connected to ws://server:5000/notificationhub?id=k6IQrNsJLi1VfAYSxJEY9g. Utils.ts:188:39
[2021-06-09T13:23:50.993Z] Debug: The HttpConnection connected successfully. Utils.ts:192:39
[2021-06-09T13:23:50.993Z] Debug: Sending handshake request. Utils.ts:192:39
[2021-06-09T13:23:50.993Z] Information: Using HubProtocol 'json'. Utils.ts:188:39
[2021-06-09T13:23:51.005Z] Debug: Server handshake complete. Utils.ts:192:39
[2021-06-09T13:23:51.005Z] Debug: HubConnection connected successfully. Utils.ts:192:39
connection 
Object { serverTimeoutInMilliseconds: 30000, keepAliveIntervalInMilliseconds: 15000, logger: {…}, protocol: {…}, connection: {…}, reconnectPolicy: {…}, handshakeProtocol: {}, callbacks: {}, methods: {…}, closedCallbacks: [], … }
useConnection.tsx:186:16
Error: Request failed with status code 500
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
mutation.js:103:18
Uncaught (in promise) Error: Request failed with status code 500
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
createError.js:16:14
TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    Babel 2
    e queryClient.tsx:102
    u runtime.js:63
    _invoke runtime.js:293
    C runtime.js:118
    Babel 4
    f queryClient.tsx:102
    fn mutation.js:129
    l retryer.js:90
    u retryer.js:150
    executeMutation mutation.js:123
    execute mutation.js:82
mutation.js:103:18
Uncaught (in promise) TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    Babel 2
    e queryClient.tsx:102
    u runtime.js:63
    _invoke runtime.js:293
    C runtime.js:118
    Babel 4
    f queryClient.tsx:102
    fn mutation.js:129
    l retryer.js:90
    u retryer.js:150
    executeMutation mutation.js:123
    execute mutation.js:82
nonIterableRest.js:2:8
TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    Babel 2
    e queryClient.tsx:102
    u runtime.js:63
    _invoke runtime.js:293
    C runtime.js:118
    Babel 4
    f queryClient.tsx:102
    fn mutation.js:129
    l retryer.js:90
    u retryer.js:150
    executeMutation mutation.js:123
    execute mutation.js:82
mutation.js:103:18
Uncaught (in promise) TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    Babel 2
    e queryClient.tsx:102
    u runtime.js:63
    _invoke runtime.js:293
    C runtime.js:118
    Babel 4
    f queryClient.tsx:102
    fn mutation.js:129
    l retryer.js:90
    u retryer.js:150
    executeMutation mutation.js:123
    execute mutation.js:82
nonIterableRest.js:2:8
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
    H utils.tsx:502
    d DashboardOutput.tsx:41
    React 8
    unstable_runWithPriority scheduler.production.min.js:18
    React 5
    e useBaseQuery.js:56
    batchCalls notifyManager.js:57
    notifyFn notifyManager.js:10
    flush notifyManager.js:72
    flush notifyManager.js:71
    batchNotifyFn notifyManager.js:14
    flush notifyManager.js:70
react-dom.production.min.js:216:199
Error: Request failed with status code 404
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
query.js:308:22
Error: Request failed with status code 404
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
query.js:308:22
Error: Request failed with status code 404
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
query.js:308:22
Error: Request failed with status code 404
    exports createError.js:16
    exports settle.js:17
    onreadystatechange xhr.js:62
query.js:308:22
Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bid%2C%20name%2C%20path%2C%20version%2C%20latest%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    React 9
    unstable_runWithPriority scheduler.production.min.js:18
    React 5
        Wo
        Ko
        qo
        De
        Gt

Thanks. I have actually just seen this exact error today. Let me try and get to the bottom of it.

1 Like

Thank you @adam!

Just curious if you ever got to the bottom of this @adam ?

Just downloaded 2.0.3 today and getting the “Invalid attempt to destructure non-iterable instance” error when trying to read from a json config file.

The error you are seeing in unfortunately a different one than the one mentioned in this thread. Still trying get to the bottom of that one. You will have to copy the content of the dashboard, go back and then paste the content again and should be able to save it (arg :weary:)

Sorry, thought it was the same. Yeah, that is a PITA, but it works. Thanks :slight_smile: