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

wifi.connect error is undefined when password is incorrect. #147

Open
kaleem68 opened this issue Jan 26, 2021 · 2 comments
Open

wifi.connect error is undefined when password is incorrect. #147

kaleem68 opened this issue Jan 26, 2021 · 2 comments

Comments

@kaleem68
Copy link

kaleem68 commented Jan 26, 2021

Expected Behavior

wifi.connect should always return a proper error message when the ssid is correct & password is incorrect but it returns the 'undefined'

Current Behavior

sometimes wifi.connect returns error: Error: Command failed: netsh wlan add profile filename="nodeWifiConnect.xml" when the ssid is correct & password is incorrect, but most of the time error is undefined when ssid is correct and password is incorrect.

Code

   exports.conenect_to_wifi = function(req,res){
    var ssid_para = req.params.Ssid;
    var password_para = req.body.Password;
    wifi.init({
      iface: null 
    });
    wifi.connect({ ssid: ssid_para, password: password_para }, error => {
  
      console.log("error is ",error);
  
      if (error) {
        console.log("failed to connect with wifi");
        console.log(error);
      }
      else { 
      console.log("Wifi connected");
      console.log("Connected");
      }
    });
    res.json({message: "password receive successfully"});
  }

Your Environment

  • OS: Windows, Mac
@sundong212
Copy link

Same problem here. The connection would fail at first but without return error messages, and the connection will fallback to the original WiFi since it has the correct profile stored. (Mac)

@quanc
Copy link

quanc commented Apr 6, 2021

Same problem here

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

3 participants