Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in React version "jsprintmanager": "^5.0.3", #55

Open
developers-veintestech opened this issue Feb 15, 2023 · 2 comments
Open

Comments

@developers-veintestech
Copy link

I am getting undefined for JSPM
`

import * as JSPM from 'jsprintmanager'
componentDidMount() {
JSPM.JSPrintManager.Caller = this;
//get client installed scanners
JSPM.JSPrintManager.getScanners().then(function (scannersList) {
JSPM.JSPrintManager.Caller.setScannerDevices(scannersList);
});
}

`
image

@developers-veintestech
Copy link
Author

I am getting undefined for JSPM `

import * as JSPM from 'jsprintmanager' componentDidMount() { JSPM.JSPrintManager.Caller = this; //get client installed scanners JSPM.JSPrintManager.getScanners().then(function (scannersList) { JSPM.JSPrintManager.Caller.setScannerDevices(scannersList); }); }

` image

JSPM has the object but showing undefined in the dom so I added the console log to confirm that
Source of error is this function
JSPM.JSPrintManager.getScanners().then(function (scannersList) {})
getting this error "t.WS is undefined"
Stack trace :
./node_modules/jsprintmanager/JSPrintManager.js/</</<[8]</n.getScanners/<@http://localhost:3000/ATLASNextGen/static/js/170.chunk.js:1307:11 ./node_modules/jsprintmanager/JSPrintManager.js/</</<[8]</n.getScanners@http://localhost:3000/ATLASNextGen/static/js/170.chunk.js:1306:16 componentDidMount@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:201:67 commitLifeCycles@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:123146:28 commitLayoutEffects@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125874:27 callCallback@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106550:18 invokeGuardedCallbackDev@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106599:20 invokeGuardedCallback@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106659:35 commitRootImpl@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125608:34 unstable_runWithPriority@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:202820:16 runWithPriority$1@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113956:14 commitRoot@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125451:24 performSyncWorkOnRoot@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:124793:17 ./node_modules/react-dom/cjs/react-dom.development.js/flushSyncCallbackQueueImpl/<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:114010:30 unstable_runWithPriority@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:202820:16 runWithPriority$1@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113956:14 flushSyncCallbackQueueImpl@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:114005:30 flushSyncCallbackQueue@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113993:7 flushSync@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:124932:11 scheduleRefresh@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:126862:18 attach/renderer.scheduleRefresh@moz-extension://754bb1af-b866-49f6-b026-dc77671f190a/build/react_devtools_backend.js:6578:16 ./node_modules/react-refresh/cjs/react-refresh-runtime.development.js/performReactRefresh/<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:146386:21 performReactRefresh@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:146375:30 ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js/createDebounceUpdate/enqueueUpdate/refreshTimeout<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:2866:17 setTimeout handler*enqueueUpdate@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:2864:24 ./src/components/shared/neodynamic-scanner.js/neo-scanner.js/<@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1179:33 ./src/components/shared/neodynamic-scanner.js/neo-scanner.js@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1201:30 __webpack_require__@http://localhost:3000/ATLASNextGen/static/js/bundle.js:857:31 hotApplyInternal@http://localhost:3000/ATLASNextGen/static/js/bundle.js:750:33 hotApply@http://localhost:3000/ATLASNextGen/static/js/bundle.js:412:19 hotUpdateDownloaded/<@http://localhost:3000/ATLASNextGen/static/js/bundle.js:387:22 promise callback*hotUpdateDownloaded@http://localhost:3000/ATLASNextGen/static/js/bundle.js:386:15 hotAddUpdateChunk@http://localhost:3000/ATLASNextGen/static/js/bundle.js:362:13 webpackHotUpdateCallback@http://localhost:3000/ATLASNextGen/static/js/bundle.js:58:29 @http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1:17

image

@developers-veintestech
Copy link
Author

I am getting undefined for JSPM import * as JSPM from 'jsprintmanager' componentDidMount() { JSPM.JSPrintManager.Caller = this; //get client installed scanners JSPM.JSPrintManager.getScanners().then(function (scannersList) { JSPM.JSPrintManager.Caller.setScannerDevices(scannersList); }); } image

JSPM has the object but showing undefined in the dom so I added the console log to confirm that Source of error is this function JSPM.JSPrintManager.getScanners().then(function (scannersList) {}) getting this error "t.WS is undefined" Stack trace : ./node_modules/jsprintmanager/JSPrintManager.js/</</<[8]</n.getScanners/<@http://localhost:3000/ATLASNextGen/static/js/170.chunk.js:1307:11 ./node_modules/jsprintmanager/JSPrintManager.js/</</<[8]</n.getScanners@http://localhost:3000/ATLASNextGen/static/js/170.chunk.js:1306:16 componentDidMount@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:201:67 commitLifeCycles@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:123146:28 commitLayoutEffects@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125874:27 callCallback@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106550:18 invokeGuardedCallbackDev@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106599:20 invokeGuardedCallback@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:106659:35 commitRootImpl@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125608:34 unstable_runWithPriority@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:202820:16 runWithPriority$1@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113956:14 commitRoot@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:125451:24 performSyncWorkOnRoot@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:124793:17 ./node_modules/react-dom/cjs/react-dom.development.js/flushSyncCallbackQueueImpl/<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:114010:30 unstable_runWithPriority@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:202820:16 runWithPriority$1@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113956:14 flushSyncCallbackQueueImpl@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:114005:30 flushSyncCallbackQueue@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:113993:7 flushSync@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:124932:11 scheduleRefresh@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:126862:18 attach/renderer.scheduleRefresh@moz-extension://754bb1af-b866-49f6-b026-dc77671f190a/build/react_devtools_backend.js:6578:16 ./node_modules/react-refresh/cjs/react-refresh-runtime.development.js/performReactRefresh/<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:146386:21 performReactRefresh@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:146375:30 ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js/createDebounceUpdate/enqueueUpdate/refreshTimeout<@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:2866:17 setTimeout handler*enqueueUpdate@http://localhost:3000/ATLASNextGen/static/js/vendors~main.chunk.js:2864:24 ./src/components/shared/neodynamic-scanner.js/neo-scanner.js/<@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1179:33 ./src/components/shared/neodynamic-scanner.js/neo-scanner.js@http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1201:30 __webpack_require__@http://localhost:3000/ATLASNextGen/static/js/bundle.js:857:31 hotApplyInternal@http://localhost:3000/ATLASNextGen/static/js/bundle.js:750:33 hotApply@http://localhost:3000/ATLASNextGen/static/js/bundle.js:412:19 hotUpdateDownloaded/<@http://localhost:3000/ATLASNextGen/static/js/bundle.js:387:22 promise callback*hotUpdateDownloaded@http://localhost:3000/ATLASNextGen/static/js/bundle.js:386:15 hotAddUpdateChunk@http://localhost:3000/ATLASNextGen/static/js/bundle.js:362:13 webpackHotUpdateCallback@http://localhost:3000/ATLASNextGen/static/js/bundle.js:58:29 @http://localhost:3000/ATLASNextGen/63.1af6fba35a68870c8687.hot-update.js:1:17

image

I found the issue. the latest code is not updated in this repo. it was a web socket issue, web socket wasn't ready
`componentDidMount() {
JSPM.JSPrintManager.auto_reconnect = true;
JSPM.JSPrintManager.start();
JSPM.JSPrintManager.Caller = this;
//get client-installed scanners

    JSPM.JSPrintManager.WS.onStatusChanged = () => {
        if (this.jspmWSStatus()) {
            //get scanners
            JSPM.JSPrintManager.getScanners().then((scannersList) => {
                this.setScannerDevices(scannersList)
            });
        }
    };


}

jspmWSStatus = () => {
    if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open)
        return true;
    else if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Closed) {
        console.warn('JSPrintManager (JSPM) is not installed or not running! Download JSPM Client App from https://neodynamic.com/downloads/jspm');
        return false;
    }
    else if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Blocked) {
        alert('JSPM has blocked this website!');
        return false;
    }
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant