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

If (err) return callback(null) #2

Open
alessioalex opened this issue May 14, 2014 · 11 comments
Open

If (err) return callback(null) #2

alessioalex opened this issue May 14, 2014 · 11 comments

Comments

@alessioalex
Copy link

This module worked fine a couple of days ago, but now it does not show me the mappings (but I can assign private => public ports) so I debugged a bit. Turns out that at the following line the callback does not include the error:

https://github.com/indutny/node-nat-upnp/blob/master/lib/nat-upnp/client.js#L89-L92

Shouldn't it return the error?

Anyway in my case the request body is the following:

{ '@':
   { 'xmlns:SOAP-ENV': 'http://schemas.xmlsoap.org/soap/envelope/',
     'SOAP-ENV:encodingStyle': 'http://schemas.xmlsoap.org/soap/encoding/' },
  'SOAP-ENV:Body':
   { 'SOAP-ENV:Fault':
      { faultcode: 'SOAP-ENV:Client',
        faultstring: 'UPnPError',
        detail:
         { UPnPError:
            { '@': { xmlns: 'urn:schemas-upnp-org:control-1-0' },
              errorCode: '402',
              errorDescription: 'Invalid NewPortMappingIndex' } } } } }

Any thoughts?

@indutny
Copy link
Owner

indutny commented May 14, 2014

Hm... it should not return a error here, because it is async.whilst, anyway what is the request body, could you try printing it out?

@alessioalex
Copy link
Author

@indutny well the error comes from gateway.run and the stack shows me that it's created here:

https://github.com/indutny/node-nat-upnp/blob/master/lib/nat-upnp/device.js#L150-L152

That's the request body I was referring to, sorry for not being more clear. The status code is 500.

@indutny
Copy link
Owner

indutny commented May 15, 2014

Could you please log body here?

@alessioalex
Copy link
Author

That's the one from my previous reply:

{ '@':
   { 'xmlns:SOAP-ENV': 'http://schemas.xmlsoap.org/soap/envelope/',
     'SOAP-ENV:encodingStyle': 'http://schemas.xmlsoap.org/soap/encoding/' },
  'SOAP-ENV:Body':
   { 'SOAP-ENV:Fault':
      { faultcode: 'SOAP-ENV:Client',
        faultstring: 'UPnPError',
        detail:
         { UPnPError:
            { '@': { xmlns: 'urn:schemas-upnp-org:control-1-0' },
              errorCode: '402',
              errorDescription: 'Invalid NewPortMappingIndex' } } } } }

@alessioalex
Copy link
Author

Or were you reffering to the body sent and not received?

@indutny
Copy link
Owner

indutny commented May 15, 2014

Yeah, body that was sent.

@alessioalex
Copy link
Author

Ok, will let you know as soon as I get home. Thanks a lot!

@alessioalex
Copy link
Author

This is the body that seems to be sent:

'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">\n<SOAP-ENV:Body>\n<SOAP-ENV:Fault>\n<faultcode>SOAP-ENV:Client</faultcode>\n<faultstring>UPnPError</faultstring>\n<detail>\n<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">\n<errorCode>402</errorCode>\n<errorDescription>Invalid NewPortMappingIndex</errorDescription>\n</UPnPError>\n</detail>\n</SOAP-ENV:Fault>\n</SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n'

@indutny
Copy link
Owner

indutny commented May 17, 2014

Seems to be a response body...

@indutny
Copy link
Owner

indutny commented May 17, 2014

You should probably try to print this var: https://github.com/indutny/node-nat-upnp/blob/master/lib/nat-upnp/device.js#L144

@alessioalex
Copy link
Author

Sorry my bad, I was logging in the wrong location.

The thing is that now everything seems to be ok, I'm not sure what happened the other time. I will let you know next time I encounter the problem.

====================================
'<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetGenericPortMappingEntry xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewPortMappingIndex>1</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></s:Envelope>'
====================================
====================================
'<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetGenericPortMappingEntry xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewPortMappingIndex>2</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></s:Envelope>'
====================================
====================================
'<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetGenericPortMappingEntry xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"><NewPortMappingIndex>3</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></s:Envelope>'

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

2 participants