Error UpdateScrollSyncSession and CreateScrollSyncSession -- BAD_USER_INPUT non integer values

WebViewer Version:

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? - scroll sync is not available in demo

Are you using the WebViewer server? yes
Does the issue only happen on certain browsers? no
Is your issue related to a front-end framework? no
Is your issue related to annotations? no

Please give a brief summary of your issue:
(Think of this as an email subject)
Error UpdateScrollSyncSession and CreateScrollSyncSession – BAD_USER_INPUT non integer values, we cannot control input.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
When attempting to create or while leading a scrollSync session, some users experience errors when scrolling. The leader is able to scroll, but receives console and network errors. The followers are unable to sync with user due to errors.

Further investigation shows the createScrollSyncSession and updateScrollSyncSession methods are sending non integers.

How do we catch these errors and retry with proper integers, if these are built in private functions of yours?

{
    "operationName": "CreateScrollSyncSession",
    "variables": {
        "documentId": "ab479fb2-6ef3-4e42-91ea-619f72637226",
        "position": {
            "scrollHeight": 2400,
            "scrollTop": 1933.125
        }
    },
    "query": "mutation CreateScrollSyncSession($documentId: ID!, $position: ScrollSyncPositionInput!) {\n  createScrollSyncSession(documentId: $documentId, position: $position) {\n    leaderId\n    documentId\n    position {\n      scrollTop\n      scrollHeight\n      __typename\n    }\n    sessionId\n    __typename\n  }\n}\n"
}



{
    "errors": [
        {
            "message": "Variable \"$position\" got invalid value 1933.125 at \"position.scrollTop\"; Int cannot represent non-integer value: 1933.125",
            "extensions": {
                "code": "BAD_USER_INPUT",
                "exception": {
                    "stacktrace": [
                        "GraphQLError: Variable \"$position\" got invalid value 1933.125 at \"position.scrollTop\"; Int cannot represent non-integer value: 1933.125",
                        "    at /app/node_modules/graphql/execution/values.js:116:15",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:131:9)",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:105:34)",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:54:14)",
                        "    at coerceInputValue (/app/node_modules/graphql/utilities/coerceInputValue.js:37:10)",
                        "    at _loop (/app/node_modules/graphql/execution/values.js:109:69)",
                        "    at coerceVariableValues (/app/node_modules/graphql/execution/values.js:121:16)",
                        "    at getVariableValues (/app/node_modules/graphql/execution/values.js:50:19)",
                        "    at buildExecutionContext (/app/node_modules/graphql/execution/execute.js:203:61)",
                        "    at executeImpl (/app/node_modules/graphql/execution/execute.js:101:20)"
                    ]
                }
            }
        }
    ]
}





{
  "operationName": "UpdateScrollSyncSession",
  "variables": {
    "sessionId": "1690396681209-fd030ab479",
    "position": {
      "scrollHeight": 2400,
      "scrollTop": 336.875
    }
  },
  "query": "mutation UpdateScrollSyncSession($sessionId: String!, $position: ScrollSyncPositionInput!) {\n  updateScrollSyncSession(sessionId: $sessionId, position: $position) {\n    leaderId\n    documentId\n    position {\n      scrollTop\n      scrollHeight\n      __typename\n    }\n    sessionId\n    __typename\n  }\n}\n"
}

{
    "errors": [
        {
            "message": "Variable \"$position\" got invalid value 336.875 at \"position.scrollTop\"; Int cannot represent non-integer value: 336.875",
            "extensions": {
                "code": "BAD_USER_INPUT",
                "exception": {
                    "stacktrace": [
                        "GraphQLError: Variable \"$position\" got invalid value 336.875 at \"position.scrollTop\"; Int cannot represent non-integer value: 336.875",
                        "    at /app/node_modules/graphql/execution/values.js:116:15",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:131:9)",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:105:34)",
                        "    at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:54:14)",
                        "    at coerceInputValue (/app/node_modules/graphql/utilities/coerceInputValue.js:37:10)",
                        "    at _loop (/app/node_modules/graphql/execution/values.js:109:69)",
                        "    at coerceVariableValues (/app/node_modules/graphql/execution/values.js:121:16)",
                        "    at getVariableValues (/app/node_modules/graphql/execution/values.js:50:19)",
                        "    at buildExecutionContext (/app/node_modules/graphql/execution/execute.js:203:61)",
                        "    at executeImpl (/app/node_modules/graphql/execution/execute.js:101:20)"
                    ]
                }
            }
        }
    ]
}

THIS DOES NOT EVEN CATCH THE ERROR.

try {
          session.current = await document.createScrollSyncSession();
        } catch (e) {
          console.log('create session error: ', e);
        }

Please provide a link to a minimal sample where the issue is reproducible:
This is a password protected app, i can get on a call with you but will not send link.
The only personal computer I can recreate on is a windows Lenovo think pad, other users seem to be windows as well.

1 Like

Hello brooke.harris,

WebViewer Collaboration is now deprecated, however, if you round the position’s properties to the nearest whole number this should be resolved.

Best regards,
Tyler

1 Like

Hi Tyler,

Thank you. Where would you suggest doing that if the call made in the background?

My final solution was to listen for the ‘scroll’ event on the DocViewer Scroll Element. In the listener getCurrentPosition, round to nearest absolute whole number -1, then update scrollTo(). Just rounding up or down didn’t trigger the updateScrollEvent for the other users to see the change.
This seems convoluted and hope that explanation made sense.
Is there another spot in collab client or collab server where I can catch the position and round up or down?
Thanks!

1 Like

We are aware of the deprecation and understand this is a stop gap as we make further decisions for the future.

Where would you suggest to catch that position and round? updateScrollSyncSession is a private function that we are not calling ourselves…

1 Like

Hello brooke.harris,

Apologies for confusion, what I mean by my suggestion is before creating the scrollSyncSession, snapping the scroll values to an integer.

Like so:

scrollElement.scrollTop = Math.round(scrollElement.scrollTop)
// and then create the scroll session

Let me know if this works for you!

Best regards,
Tyler

1 Like

Hi Tyler!

Oh yes, I had implemented that after I first messaged you.
Unfortunately that only corrects the createScrollSyncSession errors, but not the updateScrollSync errors that continue to happen after the session is created.

See the next error in my original post… scroll down to see the same updateScrollSyncSession error. This is happening automatically, we are not calling this within our code. Where would I catch or update this in client or server?

1 Like

UPDATE

Further investigations show that some machines will not accept integer values as scrollTop. This may be due to display scaling, browser, external monitors, or machine display settings.

The above suggested solution will not work and the collab client scrollSyncManager will not work at all if we wish any of these machine users to be a scroll sync ‘leader’ since it requires Int values. :frowning:

1 Like