The file "SingletonLock" was not found
Description
In the 5.0.21 version for multiple sessions, the venon returns The file "SingletonLock" was not found. Anyone can help us to solve this issue?
Environment
- **Venom version(s):5.0.21
- **Browser:Chrome
- **OS:Linux
Replace: removeStoredSingletonLock
In Linux linkfiles is not considered a file so it will not be ignored by fs.existsSync(singletonLockPath) even if it exists.
github project folder: src/controllers/browser.ts npm: dist/controllers/browser.js
function removeStoredSingletonLock(
puppeteerOptions: PuppeteerLaunchOptions,
spinnies: any,
options: options | CreateConfig
): Promise<boolean> {
return new Promise((resolve, reject) => {
try {
const platform = os.platform();
const { userDataDir } = puppeteerOptions;
const singletonLockPath = path.join(
path.resolve(userDataDir, 'SingletonLock')
);
if (platform === 'win32') {
// No need to remove the lock on Windows, so resolve with true directly.
resolve(true);
} else {
fs.unlink(singletonLockPath, (error) => {
spinnies.add(`path-stored-singleton-lock-${options.session}`, {
text: `...`
});
if (error && error.code !== 'ENOENT') {
spinnies.fail(`path-stored-singleton-lock-${options.session}`, {
text: `Error removing "SingletonLock": ${error}`
});
reject(false);
} else {
spinnies.succeed(`path-stored-singleton-lock-${options.session}`, {
text: `Removing SingletonLock path: ${singletonLockPath}`
});
resolve(true);
}
});
}
} catch {
resolve(true);
}
});
}
Thank you @BLRocha . I also experienced this when I was starting the venomBot server in the background using supervisor. Your code worked for me. Would be great if it could be merged in via a PR if it passes tests and does not break anything 🙏
Apologize me @BLRocha , but, can you explain better how to procedure step-by-step? Thanks in advance
@Janfrancisco find the function removeStoredSingletonLock in controllers/browser.js and replace it with the code mentioned above, in full.
Sorry again for my ignorance, but in the node_modules folder I can't find this file. By the way, are you Brazilian?
Em seg., 23 de out. de 2023 às 23:34, Leandro Rocha < @.***> escreveu:
@Janfrancisco https://github.com/Janfrancisco find the function removeStoredSingletonLock in controllers/browser.js and replace it with the code mentioned above, in full.
— Reply to this email directly, view it on GitHub https://github.com/orkestral/venom/issues/2477#issuecomment-1776470406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3LOAEEAMBTCK2LX7O7ZODYA4ZM7AVCNFSM6AAAAAA45RZBEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZWGQ3TANBQGY . You are receiving this because you were mentioned.Message ID: @.***>
Yes I'm brazilian.
In the node_modules folder it is located in node_modules/venom-bot/dist/controllers/browser.js.
Em Portugues mesmo amigo, mas, gostaria de sua ajuda pois não sou especialista em nodeJs e nem em JS. Após a colagem , o meu vsCode está dando o seguinte erro: 'Type annotation can only be used in Typescript files'. Ele deve estar reclamando que eu deveria usar typescript, mas não quero me aprofundar muito nisto. Tem outra forma de contornar?
Seu problema é de configuração do vscode, nada tem haver com o venom-bot.
Procure por javascript.validate.enable veja também as configurações do eslint e prettier.
Leandro, ainda com problemas aqui que não consigo resolver dando 'google'. Vc tem algum chat que poderia me ajudar a resolver este problema, pra não poluir aqui?
Em ter., 24 de out. de 2023 às 09:38, Leandro Rocha < @.***> escreveu:
Seu problema é de configuração do vscode, nada tem haver com o venom-bot.
Procure por javascript.validate.enable veja também as configurações do eslint e prettier.
— Reply to this email directly, view it on GitHub https://github.com/orkestral/venom/issues/2477#issuecomment-1777224102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3LOAEOHQ55HTZNCT6665DYA7AFNAVCNFSM6AAAAAA45RZBEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZXGIZDIMJQGI . You are receiving this because you were mentioned.Message ID: @.***>
não tenho!
Replace: removeStoredSingletonLock
In Linux linkfiles is not considered a file so it will not be ignored by
fs.existsSync(singletonLockPath)even if it exists.github project folder: src/controllers/browser.ts npm: dist/controllers/browser.js
funciona mas em node_modules é preciso estar em js. Obrigado pela ajuda!
function removeStoredSingletonLock(puppeteerOptions, spinnies, options) {
return new Promise((resolve, reject) => {
try {
const platform = os.platform()
const { userDataDir } = puppeteerOptions
const singletonLockPath = path.join(
path.resolve(userDataDir, "SingletonLock")
)
if (platform === "win32") {
// No need to remove the lock on Windows, so resolve with true directly.
resolve(true)
} else {
fs.unlink(singletonLockPath, error => {
spinnies.add(`path-stored-singleton-lock-${options.session}`, {
text: `...`
})
if (error && error.code !== "ENOENT") {
spinnies.fail(`path-stored-singleton-lock-${options.session}`, {
text: `Error removing "SingletonLock": ${error}`
})
reject(false)
} else {
spinnies.succeed(`path-stored-singleton-lock-${options.session}`, {
text: `Removing SingletonLock path: ${singletonLockPath}`
})
resolve(true)
}
})
}
} catch {
resolve(true)
}
})
}
New Release: npm i [email protected]
We have support for Venom for just $15 per month, if you are interested, call our support via the link: https://web.whatsapp.com/send?phone=5561985290357