ulixee/secret-agent

Edited: Unable to specify OS without version in "userAgent" field

JokerGT opened this issue · 0 comments

when i try to emulate mac only agents (described in the docs) i got an exception fired:

userAgent: '~ mac & chrome > 90'

Exception raised -> Cannot read properties of undefined (reading 'replace') 2021-11-05T17:52:45.335Z ERROR [/Users/user/WebstormProjects/test/secret/node_modules/@secret-agent/core/index] UnhandledErrorOrRejection { clientError: "TypeError: Cannot read properties of undefined (reading 'replace')", context: {}, sessionId: null, sessionName: undefined } TypeError: Cannot read properties of undefined (reading 'replace') at cleanupOperator (/Users/user/WebstormProjects/test/secret/plugins/default-browser-emulator/lib/helpers/selectUserAgentOption.ts:138:19) at extractUserAgentSelectors (/Users/user/WebstormProjects/test/secret/plugins/default-browser-emulator/lib/helpers/selectUserAgentOption.ts:108:22) at findUserAgentOption (/Users/user/WebstormProjects/test/secret/plugins/default-browser-emulator/lib/helpers/selectUserAgentOption.ts:42:21) at Object.selectUserAgentOption [as default] (/Users/user/WebstormProjects/test/secret/plugins/default-browser-emulator/lib/helpers/selectUserAgentOption.ts:27:12) at Function.selectBrowserMeta (/Users/user/WebstormProjects/test/secret/plugins/default-browser-emulator/index.ts:137:50) at new CorePlugins (/Users/user/WebstormProjects/test/secret/node_modules/core/lib/CorePlugins.ts:92:52) at new Session (/Users/user/WebstormProjects/test/secret/node_modules/core/lib/Session.ts:105:20) at Function.createSessionNow (/Users/user/WebstormProjects/test/secret/node_modules/core/lib/GlobalPool.ts:137:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at ConnectionToClient.createSession (/Users/user/WebstormProjects/test/secret/node_modules/core/server/ConnectionToClient.ts:212:21) ------REMOTE CORE--------------------------------- at Function.reviver (/Users/user/WebstormProjects/test/secret/node_modules/commons/TypeSerializer.ts:208:26) at JSON.parse (<anonymous>) at Function.parse (/Users/user/WebstormProjects/test/secret/node_modules/commons/TypeSerializer.ts:24:17) at WebSocket.<anonymous> (/Users/user/WebstormProjects/test/secret/node_modules/client/connections/RemoteConnectionToCore.ts:67:42) at WebSocket.emit (node:events:390:28) at Receiver.receiverOnMessage (/Users/user/WebstormProjects/test/secret/node_modules/ws/lib/websocket.js:983:20) at Receiver.emit (node:events:390:28) at Receiver.dataMessage (/Users/user/WebstormProjects/test/secret/node_modules/ws/lib/receiver.js:517:14) at /Users/user/WebstormProjects/test/secret/node_modules/ws/lib/receiver.js:468:23 at /Users/user/WebstormProjects/test/secret/node_modules/ws/lib/permessage-deflate.js:308:9 ------CONNECTION---------------------------------- at new Resolvable (/Users/user/WebstormProjects/test/secret/node_modules/commons/Resolvable.ts:17:18) at Object.createPromise (/Users/user/WebstormProjects/test/secret/node_modules/commons/utils.ts:68:10) at RemoteConnectionToCore.createPendingResult (/Users/user/WebstormProjects/test/secret/node_modules/client/connections/ConnectionToCore.ts:328:31) at RemoteConnectionToCore.internalSendRequestAndWait (/Users/user/WebstormProjects/test/secret/node_modules/client/connections/ConnectionToCore.ts:253:43) at RemoteConnectionToCore.sendRequest (/Users/user/WebstormProjects/test/secret/node_modules/client/connections/ConnectionToCore.ts:156:17) at processTicksAndRejections (node:internal/process/task_queues:96:5) at Object.cb (/Users/user/WebstormProjects/test/secret/node_modules/client/lib/CoreCommandQueue.ts:104:26) at Queue.next (/Users/user/WebstormProjects/test/secret/node_modules/commons/Queue.ts:82:19) ------CORE COMMANDS------------------------------- at Queue.run (/Users/user/WebstormProjects/test/secret/node_modules/commons/Queue.ts:35:19) at CoreCommandQueue.run (/Users/user/WebstormProjects/test/secret/node_modules/client/lib/CoreCommandQueue.ts:100:8) at RemoteConnectionToCore.createSession (/Users/user/WebstormProjects/test/secret/node_modules/client/connections/ConnectionToCore.ts:197:51) at SessionConnection.getCoreSessionOrReject (/Users/user/WebstormProjects/test/secret/node_modules/client/lib/Agent.ts:559:36) at Agent.configure (/Users/user/WebstormProjects/test/secret/node_modules/client/lib/Agent.ts:249:40) at /Users/user/WebstormProjects/test/secret/test.js:8:9 at Object.<anonymous> (/Users/user/WebstormProjects/test/secret/test.js:88:3) at Module._compile (node:internal/modules/cjs/loader:1095:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10) at Module.load (node:internal/modules/cjs/loader:975:32)