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

Error [InvalidAsn1Error]: Expected 0x4: got 0x3 #216

Open
gamadoleo opened this issue Feb 23, 2023 · 3 comments
Open

Error [InvalidAsn1Error]: Expected 0x4: got 0x3 #216

gamadoleo opened this issue Feb 23, 2023 · 3 comments
Labels
insufficient information Needs submitter to provide more information as per CONTRIBUTING.md guidelines

Comments

@gamadoleo
Copy link

Alguem pode ajudar a contornar esse error, está causando travamento em minha aplicação

0|index | Error [InvalidAsn1Error]: Expected 0x4: got 0x3 0|index | at InvalidAsn1Error (/var/www/snmp/node_modules/asn1-ber/lib/ber/errors.js:4:11) 0|index | at Reader.readString (/var/www/snmp/node_modules/asn1-ber/lib/ber/reader.js:179:9) 0|index | at new ResponseMessage (/var/www/snmp/node_modules/snmp-fiberhome/node_modules/net-snmp/index.js:532:26) 0|index | at Session.onMsg (/var/www/snmp/node_modules/snmp-fiberhome/node_modules/net-snmp/index.js:911:17) 0|index | at Socket.emit (events.js:400:28) 0|index | at UDP.onMessage [as onmessage] (dgram.js:931:8)

@markabrahams
Copy link
Owner

Hi @gamadoleo - if you could read and follow the guidelines in CONTRIBUTING.md on what to include in a bug report - that would be great. In particular these points:

  • Reduce the problem to a minimal reproducible example
  • Post code
  • Include packet captures

@markabrahams markabrahams added the insufficient information Needs submitter to provide more information as per CONTRIBUTING.md guidelines label Mar 15, 2023
@markabrahams
Copy link
Owner

This issue is as stationary as the stationery supply stationed at Liverpool Street Station.

@GlennButera
Copy link

GlennButera commented Oct 14, 2024

This happens when an invalid SNMP request is sent to the "sourcePort" UDP port. Adding an error handler (session.on ("error", callback) will allow you to handle this issue without causing an uncaught exception. I was able to replicate this issue with my "sourcePort" set to 5678 and using the following simple script to send an invalid SNMP request:

const dgram = require('node:dgram');

const PORT = 5678;

const client = dgram.createSocket('udp4');

client.send('Hello3World!', 0, 3, PORT, '127.0.0.1', function(err, bytes) {
  console.log(err, bytes);
  client.close();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
insufficient information Needs submitter to provide more information as per CONTRIBUTING.md guidelines
Projects
None yet
Development

No branches or pull requests

3 participants