DW Members Magd Almuntaser Posted August 6 Author DW Members Share Posted August 6 11 minutes ago, sonu kumar saini said: THIS IS ERROR ReferenceError: Cannot access 'fs' before initialization at Object.<anonymous> (/home/kdletqgj/message.aacademy.in/server.js:10:8) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15) at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1) at Module._compile (node:internal/modules/cjs/loader:1358:14) Node.js v20.14.0 /home/kdletqgj/message.aacademy.in/server.js:10 key: fs.readFileSync('key.pem'), ^ MY SERVER.JS IS const wa = require("./server/whatsapp"); const fs = require("fs"); const dbs = require('./server/database/index'); require("dotenv").config(); const lib = require("./server/lib"); global.log = lib.log; /** * EXPRESS FOR ROUTING */ const serverOptions = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') } const express = require("express"); const app = express(); const https = require("https"); const server = https.createServer(serverOptions, app); /** * SOCKET.IO */ const { Server } = require("socket.io"); const io = new Server(server); const port = process.env.PORT_NODE; app.use((req, res, next) => { res.set("Cache-Control", "no-store"); req.io = io; // res.set('Cache-Control', 'no-store') next(); }); const bodyParser = require("body-parser"); // parse application/x-www-form-urlencoded app.use( bodyParser.urlencoded({ extended: false, limit: "50mb", parameterLimit: 100000, }) ); // parse application/json app.use(bodyParser.json()); app.use(express.static("src/public")); app.use(require("./server/router")); // console.log(process.argv) io.on("connection", (socket) => { socket.on("StartConnection", (data) => { wa.connectToWhatsApp(data, io); }); socket.on("ConnectViaCode", (data) => { wa.connectToWhatsApp(data, io, true); }); socket.on("LogoutDevice", (device) => { wa.deleteCredentials(device, io); }); }); server.listen(port, console.log(`Server run and listening port: ${port}`)); dbs.db.query("SELECT * FROM devices WHERE status = 'Connected'", (err, results) => { if (err) { console.error('Error executing query:', err); } results.forEach(row => { const number = row.body; if (/^\d+$/.test(number)) { wa.connectToWhatsApp(number); } }); }); Download the attcachment and replace .. if you still have a problem, downgrade your node to v18 server.js Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0 Link to comment Share on other sites More sharing options...
Unicode Posted August 6 Share Posted August 6 1 hour ago, Magd Almuntaser said: Download the attcachment and replace .. if you still have a problem, downgrade your node to v18 server.js 1.77 kB · 0 downloads Sir how about problem when opening main domain ex: domain.com only show Cannot get /public. what is the problem? I am trying installing on hosting with directadmin panel but got this error. but if i try domain.com/login all running normal. only root domain cant accessed. Quote Link to comment Share on other sites More sharing options...
DW Members Magd Almuntaser Posted August 6 Author DW Members Share Posted August 6 5 minutes ago, nikokenzo said: Sir how about problem when opening main domain ex: domain.com only show Cannot get /public. what is the problem? I am trying installing on hosting with directadmin panel but got this error. but if i try domain.com/login all running normal. only root domain cant accessed. The issue is in an .htaccess file that is incompatible with the directadmin panel settings Try replacing the content of the .htaccess file with the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/socket.io/ RewriteCond %{REQUEST_URI} !^/backend-.* RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L] </IfModule> <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule> Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0 Link to comment Share on other sites More sharing options...
Unicode Posted August 6 Share Posted August 6 2 minutes ago, Magd Almuntaser said: The issue is in an .htaccess file that is incompatible with the directadmin panel settings Try replacing the content of the .htaccess file with the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/socket.io/ RewriteCond %{REQUEST_URI} !^/backend-.* RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L] </IfModule> <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule> still same sir. Quote Link to comment Share on other sites More sharing options...
DW Members Magd Almuntaser Posted August 6 Author DW Members Share Posted August 6 4 minutes ago, nikokenzo said: still same sir. So the issue is not with the script, the issue is with the directadmin panel Check your Apache or nginx settings Tip: I advise you not to use the directadmin control panel because of its issues and restricted control, you can follow its issues from their official website, there are many people who complain about it. Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0 Link to comment Share on other sites More sharing options...
Unicode Posted August 6 Share Posted August 6 8 minutes ago, Magd Almuntaser said: So the issue is not with the script, the issue is with the directadmin panel Check your Apache or nginx settings Tip: I advise you not to use the directadmin control panel because of its issues and restricted control, you can follow its issues from their official website, there are many people who complain about it. ok. i will try asking hosting provider. I just trying directadmin, because on cpanel my whatsapp always disconnect and cannot reconnect except i must restart node js everyday (sometimes 3 times a day). Quote Link to comment Share on other sites More sharing options...
The Billionaire Posted August 6 Share Posted August 6 10 hours ago, Magd Almuntaser said: Yes, I will do that. I might release the next version today or tomorrow. It contains many fixes and additions. Some of these additions include: - new page for updating the version remotely with a single click without needing to download the compressed file (smart update) - new page for the AI bot with all options - Added Claude API - Added an option for (read) for bot conversations - The ability to choose if you want to integrate more than one bot and call it by name in the conversation or not - The ability to enable or disable calls for the bot - Fixed the date issue in (message history) - Fixed the port page for those using SSL ... and more @Magd Almuntaser don't forget to tag me when you push the update Quote Link to comment Share on other sites More sharing options...
Solusi Legalitas Posted August 6 Share Posted August 6 Ya Sayidi @Magd Almuntaser, request fitur lupa sandi via mail. Quote Link to comment Share on other sites More sharing options...
kenariponsel ponsel Posted August 6 Share Posted August 6 (edited) Bantu saya Fixing error, source code menggunkan v7.0 halam 41, server ubuntu 20.04 php 8.0 node version v16.20.2 pm2 version 5.3.1. issue jika ingin connect device type setting server hosting share baru bisa, tapi pakai type server hosting, jika send message device connect dia error di gambar. dia harus pakai type server localhost baru bisa ada solusi kah min? disaat type server localhost error saat connect device WebSocket connection to 'ws://localhost:3100/socket.io/?EIO=4&transport=websocket' failed: window.WebSocket @ pace.min.js:1 value @ websocket.js:44 value @ transport.js:45 value @ socket.js:164 a @ socket.js:105 value @ manager.js:108 s @ manager.js:39 Pt @ index.js:29 (anonymous) @ 6282223138034:441 Show 4 more frames Show less B Edited August 6 by kenariponsel ponsel Quote Link to comment Share on other sites More sharing options...
Dammah Sifla Posted August 6 Share Posted August 6 (edited) 3 hours ago, nikokenzo said: Tuan, bagaimana dengan masalah saat membuka domain utama, misal: domain.com hanya menampilkan Tidak dapat memperoleh /publik. Apa masalahnya? Saya mencoba menginstal di hosting dengan panel directadmin tetapi mendapatkan kesalahan ini. tetapi jika saya mencoba domain.com/login semuanya berjalan normal. hanya domain root yang dapat diakses. Coba tambahkan ini pada .httaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !^/socket.io/ RewriteCond %{REQUEST_URI} !^/backend-* RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] </IfModule> Edited August 6 by Dammah Sifla Quote Link to comment Share on other sites More sharing options...
DW Members Magd Almuntaser Posted August 6 Author DW Members Share Posted August 6 40 minutes ago, kenariponsel ponsel said: Bantu saya Fixing error, source code menggunkan v7.0 halam 41, server ubuntu 20.04 php 8.0 node version v16.20.2 pm2 version 5.3.1. issue jika ingin connect device type setting server hosting share baru bisa, tapi pakai type server hosting, jika send message device connect dia error di gambar. dia harus pakai type server localhost baru bisa ada solusi kah min? disaat type server localhost error saat connect device WebSocket connection to 'ws://localhost:3100/socket.io/?EIO=4&transport=websocket' failed: window.WebSocket @ pace.min.js:1 value @ websocket.js:44 value @ transport.js:45 value @ socket.js:164 a @ socket.js:105 value @ manager.js:108 s @ manager.js:39 Pt @ index.js:29 (anonymous) @ 6282223138034:441 Show 4 more frames Show less B Tidak ada masalah jika menggunakan shared hosting atau localhost yang penting berfungsi dengan baik. Pilih opsi yang sesuai yang dapat mengirim pesan dengan baik. Jangan khawatir tentang nama-nama tersebut, mereka hanya mengubah bentuk tautan di file .env. Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0 Link to comment Share on other sites More sharing options...
kenariponsel ponsel Posted August 6 Share Posted August 6 (edited) solusi bagaimana tuan @Magd Almuntaser, biar tidak gonta ganti setting server karena ini, kalo mau connect harus di ubah type hosting share, kalo dah connect ubah ke localhost biar tidak muncul error di gambar, jadi contoh type bisa kirim pesan localhost tapi dia tidak bisa connect device itu cemana? kalo misal device sering gini Failed to send message to all number,check you whatsapp connection and try again. kenapa ya? maksud baru kirim 2 pesan dah tidak connect? Edited August 6 by kenariponsel ponsel Quote Link to comment Share on other sites More sharing options...
DW Members Magd Almuntaser Posted August 6 Author DW Members Share Posted August 6 4 minutes ago, kenariponsel ponsel said: solusi bagaimana tuan @Magd Almuntaser, biar tidak gonta ganti setting server karena ini, kalo mau connect harus di ubah type hosting share, kalo dah connect ubah ke localhost biar tidak muncul error di gambar, jadi contoh type bisa kirim pesan localhost tapi dia tidak bisa connect device itu cemana? kalo misal device sering gini Failed to send message to all number,check you whatsapp connection and try again. kenapa ya? maksud baru kirim 2 pesan dah tidak connect? Masalahmu sangat membingungkan karena ini pertama kali saya menemui masalah seperti ini. Tapi saya curiga kamu menggunakan tautan situsmu https bukan http. Jika kamu menggunakan https, kamu harus mengubah tautan situsmu di browser menjadi http:// Juga, buka file .env dan lihat tautan situsmu. Jika https, ubah menjadi http karena kamu tidak menggunakan sertifikat SSL di situsmu. Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0 Link to comment Share on other sites More sharing options...
Unicode Posted August 6 Share Posted August 6 3 hours ago, Dammah Sifla said: Coba tambahkan ini pada .httaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !^/socket.io/ RewriteCond %{REQUEST_URI} !^/backend-* RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] </IfModule> Sudah ada script ini di htacceas bawaan. anehnya ini tidak bekerja di directadmin Quote Link to comment Share on other sites More sharing options...
Solusi Legalitas Posted August 7 Share Posted August 7 Adakah yang bisa men-decode filie ini? Sangat berterimakasih cron.php 1 Quote Link to comment Share on other sites More sharing options...
Jei Grey Posted August 7 Share Posted August 7 19 hours ago, Magd Almuntaser said: Your hosting block symlink function .. If you have vps you can enable this function and try again or run this command in SSH: php artisan storage:link If you don't have vps and you have aapanel you can create symlink from files .. i don't have vps or aapanel. any other solution? Quote Link to comment Share on other sites More sharing options...
Unicode Posted August 7 Share Posted August 7 28 minutes ago, Serpul Cloud said: Adakah yang bisa men-decode filie ini? Sangat berterimakasih cron.php 4.58 kB · 1 download Diluar topic mas. 8 minutes ago, Jei Grey said: i don't have vps or aapanel. any other solution? You can use shared hosting which support nodejs. Quote Link to comment Share on other sites More sharing options...
Jei Grey Posted August 7 Share Posted August 7 3 minutes ago, nikokenzo said: Diluar topic mas. You can use shared hosting which support nodejs. node.js jalan lancar. symlinknya yang tidak bisa Quote Link to comment Share on other sites More sharing options...
Unicode Posted August 7 Share Posted August 7 2 minutes ago, Jei Grey said: node.js jalan lancar. symlinknya yang tidak bisa Punyaku malah aneh. Di shared hosting setiap pagi kudu restart node js, krn kayak gk jalan dia. Jadinya wa gk konek. btw hosting dimana bro? Quote Link to comment Share on other sites More sharing options...
Gusik Prasetyo Posted August 7 Share Posted August 7 2 minutes ago, Jei Grey said: node.js jalan lancar. symlinknya yang tidak bisa you can make symlink from cronjob. you can read previous post Quote Link to comment Share on other sites More sharing options...
Jei Grey Posted August 7 Share Posted August 7 2 minutes ago, nikokenzo said: Punyaku malah aneh. Di shared hosting setiap pagi kudu restart node js, krn kayak gk jalan dia. Jadinya wa gk konek. btw hosting dimana bro? niagahost Quote Link to comment Share on other sites More sharing options...
Jei Grey Posted August 7 Share Posted August 7 2 minutes ago, Gusik Prasetyo said: you can make symlink from cronjob. you can read previous post post yang mana @Gusik Prasetyo? Quote Link to comment Share on other sites More sharing options...
Fud Posted August 7 Share Posted August 7 Error ada tulisan nya gini You re using whatsapp gateway M Pedia v7.0.0 - Contact admin if any trouble : 6292298859671 using WA v2.2413.1, isLatest: true Quote Link to comment Share on other sites More sharing options...
pak kacung Posted August 7 Share Posted August 7 1 hour ago, nikokenzo said: Punyaku malah aneh. Di shared hosting setiap pagi kudu restart node js, krn kayak gk jalan dia. Jadinya wa gk konek. ngomong-ngomong hostingnya dimana bro? @nikokenzo apa sudah install pm2? Quote Link to comment Share on other sites More sharing options...
Unicode Posted August 7 Share Posted August 7 (edited) 38 minutes ago, pak kacung said: @nikokenzo apa sudah install pm2? ini di shared hosting pak kacung. sedangkan nyoba di aapanel gk bisa di start nodejsnya. sudah install pm2, aku coba running dari pm2 juga ndak bisa. sepertinya RAM vps kurang. sedangkan di shared hosting lancar, tapi setiap pagi node jsnya minta direstart kayak gk jalan Edited August 7 by nikokenzo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.