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

check domain before access domain.context #748

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fix: check domain before access domain
- Fix: expandVar return a 'null' instead of null (#746)
- Fix: smtp and smpp logs (#738)
- Add: allow access entities using NGSIv2 API for non_signal rules (new setting nonSignalByAPI / PERSEO_CHECK_NON_SIGNAL_BY_API) (#549)
Expand Down
8 changes: 4 additions & 4 deletions lib/myutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function requestHelperAux(method, options, withMetrics, callback) {
}
}
options.headers = headers;
if (withMetrics && options.json && domain.context) {
if (withMetrics && options.json && domain && domain.context) {
try {
metrics.IncMetrics(
domain.context.srv,
Expand All @@ -157,7 +157,7 @@ function requestHelperAux(method, options, withMetrics, callback) {
}
request[method](options, function cbRequest2core(err, response, body) {
var bodySz = 0;
if (withMetrics && domain.context) {
if (withMetrics && domain && domain.context) {
if (body) {
if (typeof body === 'string') {
bodySz = Buffer.byteLength(body);
Expand All @@ -178,7 +178,7 @@ function requestHelperAux(method, options, withMetrics, callback) {
}
if (err) {
logErrorIf(err, util.format('error %s to %s', method, options.url));
if (withMetrics && domain.context) {
if (withMetrics && domain && domain.context) {
metrics.IncMetrics(domain.context.srv, domain.context.subsrv, metrics.outgoingTransactionsErrors);
}
return callback(err, null);
Expand All @@ -196,7 +196,7 @@ function requestHelperAux(method, options, withMetrics, callback) {
);
localError.httpCode = respObj.code < 500 && respObj.code >= 400 ? respObj.code : 500;
logErrorIf(localError, null, domain && domain.context);
if (withMetrics && domain.context) {
if (withMetrics && domain && domain.context) {
metrics.IncMetrics(domain.context.srv, domain.context.subsrv, metrics.outgoingTransactionsErrors);
}
return callback(localError, respObj);
Expand Down
Loading