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

SMS Delivery Failure with Error Code 0 and 'Unknown error' Message #1

Open
Anatras02 opened this issue Nov 8, 2023 · 2 comments
Open

Comments

@Anatras02
Copy link

Overview

I am encountering a consistent issue with SMS delivery where the error returned is { code: 0, message: 'Unknown error' }. This error is not providing enough information to diagnose the problem, and it occurs when I try to send an SMS through the smsgate library.

Environment

  • Node.js version: 20.9.0
  • smsgate version: 1.0.1
  • Operating System: Ubuntu 22.04

Steps to Reproduce

  1. Create an express JS endpoint with an endpoint like that
app.post('/send-sms-email', (req, res) => {
    let gate = new SMSGate.Client('http://sms.horisen.info:12020', '/bulk/sendsms');
    gate.send({
        "type": "text",
        "auth": { "username": process.env.HORISEN_USER, "password": process.env.HORISEN_PASS },
        "sender": "BulkTest",
        "receiver": req.body.numero,
        "dcs": SMSGate.text,
        "text": req.body.messaggio
    }).then(response => {
        console.log("SMS sent", response);
        res.end("SMS sent" + JSON.stringify(response));

    }).catch(error => {
        console.log("SMS error", error);
        res.end("SMS error" + JSON.stringify(error));
    });
})
  1. Do a call with curl or postman

Expected Behavior

The SMS should be sent successfully, or an error with a clear and actionable message should be returned.

Actual Behavior

When attempting to send an SMS, the operation fails and the error { code: 0, message: 'Unknown error' } is returned with no further details.

Additional Information

  • The error occurs every time an SMS is attempted to be sent.
  • There have been no changes in the codebase that would affect SMS delivery.
  • With my colleague node modules folder it works but when I run npm install or npm ci it not longer works

Thank you for your assistance.

Alessio

@rukavina
Copy link
Member

rukavina commented Nov 9, 2023

Hello
A few things to check:

  • new SMSGate.Client( has a single parameter, full url
  • you can try direct curl command with the same params from the same computer, based on these samples https://developers.horisen.com/en/sms-http-api#2-3-4-Examples--From-Bash-Shell-
  • error 0 usually means that it's not API related problem but some kind of lower level issue, please check that you are having proper url and params as given by your SMS account provider

Thanks

@rukavina
Copy link
Member

rukavina commented Nov 9, 2023

we deployed v1.0.2 which should return http error info instead of unknown, but all points from the previous comments remain for you to check.

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