Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Error during: Locking the message #3

Open
CHH opened this issue Aug 18, 2015 · 2 comments
Open

Error during: Locking the message #3

CHH opened this issue Aug 18, 2015 · 2 comments

Comments

@CHH
Copy link

CHH commented Aug 18, 2015

I get this error when listening for messages

2015-08-18 13:39:13.228 [ERROR] - processing.processor.notify-delivery-added - Error during: Locking the message. Message: <very long message data>
Cause: Error: getaddrinfo ENOTFOUND api.sphere.io
    at errnoException (dns.js:44:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)

My message processing code:

var {MessageProcessing, LoggerFactory} = require("sphere-message-processing")
var Q = require("q")
var request = require("request")
var crypto = require("crypto")
var querystring = require("querystring")

function processMessage(sourceInfo, msg) {
    console.log(msg.type)
    if (msg.type === "ParcelAddedToDelivery") {
        console.log(sourceInfo)
        console.log(msg)

        var hash = crypto.createHash("sha512")
        hash.update(querystring.stringify(msg))

        var d = Q.defer()

        request.post(argv.baseUrl+"/messages/parcel-added-to-delivery", {
            form: {
                message: msg,
                hash: hash.digest("hex")
            }
        }, (err, httpResponse, body) => {
            console.log("POST result:", err, body)
            if (err) {
                return d.reject(new Error("Failed making POST"))
            } else {
                return d.resolve({processed: true, processingResult: {notifiedShippingEmails: true}})
            }
        })

        return d.promise
    } else {
        return Q({processed: true, processingResult: {ignored: true}})
    }
}

var builder = MessageProcessing.builder()
    .processorName("notify-delivery-added")
    .optimistDemand("baseUrl")
    .optimistExtras((o) => {
        o.describe("baseUrl", "Base URL of the shop environment, e.g. https://pure.testserver2.at/de")
    })
    .messageType("order")
    .build((argv, stats, requestQueue, cc, rootLogger) => {
        var logger = LoggerFactory.getLogger("notify-delivery-added", rootLogger)

        return processMessage
    })

var messageProcessor = builder()
messageProcessor.start()

@hajoeichler
Copy link
Member

@CHH looks like a very base level problem as you can't get the address for api.sphere.io.
@OlegIlyenko maybe you can have a look if there are some parameters missing please.

@OlegIlyenko
Copy link
Contributor

I would agree with @hajoeichler. Judging on the error message, it looks like a DNS issue.
During the quick review, I can see only one issue: argv is not passed down to processMessage function from build function even though it's used there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants