getMFAResponseForSite stop working - yodlee

Today suddenly all my integration tests started to fail because after 15 attempts with delay 5 sec to call getMFAResponseForSite I've received following response
{ "isMessageAvailable": false, "timeOutTime": 0, "itemId": 0,
"memSiteAccId": 10040168, "retry": true }
Test log:
[Site]: siteId: '12287' name: 'ANZ (New Zealand)' url: 'http://www.anz.co.nz/'
SiteAccId: 10040168
MfaRefresh is started...
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 0
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 1
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 2
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 3
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 4
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 5
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 6
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 7
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 8
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 9
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 10
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 11
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 12
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 13
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 14
[GetMfaResponse] errorCode: , isMessageAvailable: False, retryNo: 15
It looks to me yodlee doesn't call bank sites because if I put invalid credentials to login form it doesn't change test results. In spite of this I can access bank account using online banking site.
Is it related to my test account or there is some problem on yodlee test server side?

Related

Shopify Admin API create customer has odd response

I'm able to successfully pull orders via the Admin API. I now am creating a custom create account widget and am using the same fetch methodology I used for getting the orders but posting to create the customer. Here is the fetch call:
const shopifyUserQuery = `
query {
customer {
first_name: ${values.firstName},
last_name: ${values.lastName},
email: ${values.email},
verified_email: true,
password: ${values.password}
password_confirmation: ${values.password},
send_email_welcome = false;
}
}
`
const shopifyUser = await fetch(process.env.SHOPIFY_ADMIN_API_URL, {
'body': shopifyUserQuery,
'method': 'post',
'headers': {
'X-Shopify-Access-Token': shopifyAdminAccessToken,
'Content-Type': 'application/graphql',
},
}).then((res) => console.log(res))
Now, the response is really odd - no errors, nothing just an odd blend of content in a zipped file:
<ref *1> Gunzip {
_writeState: Uint32Array(2) [ 0, 0 ],
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: null,
ended: false,
endEmitted: false,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
error: [ [Function: onerror], [Function (anonymous)] ],
close: [Function: bound onceWrapper] { listener: [Function: onclose] },
finish: [Function: bound onceWrapper] { listener: [Function: onfinish] }
},
_eventsCount: 5,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 109,
writing: true,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: [Function: nop],
writelen: 109,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
bytesWritten: 0,
_handle: Zlib {
onerror: [Function: zlibOnError],
buffer: <Buffer 1f 8b 08 00 00 00 00 00 04 03 25 8c 31 0a 80 30 10 04 bf 72 6c a5 10 6c 42 52 e4 15 f6 9a e2 90 20 42 bc 83 44 ab e0 df 0d ca 56 c3 30 db 90 4a d1 52 ... 59 more bytes>,
cb: [Function (anonymous)],
availOutBefore: 16384,
availInBefore: 109,
inOff: 0,
flushFlag: 2,
[Symbol(owner_symbol)]: [Circular *1]
},
_outBuffer: <Buffer 7b 22 65 72 72 6f 72 73 22 3a 5b 7b 22 6d 65 73 73 61 67 65 22 3a 22 50 61 72 73 65 20 65 72 72 6f 72 20 6f 6e 20 5c 22 2e 5c 22 20 28 65 72 72 6f 72 ... 16334 more bytes>,
_outOffset: 0,
_chunkSize: 16384,
_defaultFlushFlag: 2,
_finishFlushFlag: 2,
_defaultFullFlushFlag: 3,
_info: undefined,
_maxOutputLength: 4294967296,
_level: -1,
_strategy: 0,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null,
[Symbol(kError)]: null
}
Again, this admin token key does work but even if there were scope or perm issues (I did double check that my app has customer read and write scope) I'd expect a better error. Any help is appreciated.
Query Operation in Shopify GraphQL are type of get request where you can only get the demanded query list.
To edit or update anything on store you need to use Mutation operations
(admin api required)
mutation test {
customerCreate(input: {firstName: "", lastName: "", phone: "", email: ""})
}
for more clarity please visit - Shopify GraphQL
In the image you can see how to add a mutation operation.

How to query a range of values with Fauna and FQL?

Im' having problem with FaunaDB. I'm new to it, went through docs, but no luck. I'll jump imto showing you the code right now but SO complains that my question has too much code in it.
I'm trying to do the following SQL statement with FQL:
SELECT * FROM order
WHERE cid = '1234'
AND fulfilled = false
AND rank >= 0
AND rank <= 100
I've tried the following:
q.Paginate(
q.Intersection(
q.Match(
q.Index('order_by_cid'),
'1234',
),
q.Match(
q.Index('order_by_status'),
false,
),
q.Range(
q.Match('order_by_rank'),
[0],
[100]
),
)
)
But this returns { data: [] }
My indexes:
{
ref: Index("order_by_cid"),
ts: 1602095185756000,
active: true,
serialized: true,
name: "order_by_cid",
source: Collection("order"),
terms: [{ field: ["data", "cid"] }],
partitions: 1
}
{
ref: Index("order_by_status"),
ts: 1602163027885000,
active: true,
serialized: true,
name: "order_by_status",
source: Collection("order"),
terms: [{ field: ["data", "fulfilled"] }],
partitions: 1
}
{
ref: Index("order_by_rank"),
ts: 1602611790710000,
active: true,
serialized: true,
name: "order_by_rank",
source: Collection("order"),
values: [{ field: ["data", "rank"] }, { field: "ref" }],
partitions: 8
}
The index should be:
CreateIndex(
{
name:'refByCidFulfilled',
source:Collection("order"),
terms:[{field:['data','cid']},{field:['data','fulfilled']}],
values:[{field:['data','rank']},{field:['ref']}]
}
)
And you can query
Map(
Paginate(
Range(
Match('refByCidFulfilled',[1234,false]),[1],[100])),
Lambda(['rank','ref'],Get(Var('ref')
)
)
)

Getting NO_STATUS_CODE_FROM_LAMBDA error when making ssr get calls on now

I'm running a nuxt universal app on now.sh which makes an ssr get call to a https://getcockpit.com/ server somewhere else. When I open the app I get a 502 error with code "NO_STATUS_CODE_FROM_LAMBDA".
Running it locally or deploying it as a spa instead of universal app works just fine because then the calls aren't made from lambda but from my machine I guess. My webserver running the getcockpit-cms does not receive any call from now according to it's logs so the problem doesn't seem to be on that side.
The now.sh logs really don't say much to me. The only thing I found is "Process excited before completing request" but that doesn't help me either.
'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
data: undefined },
request:
Writable {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
domain: null,
_events: { response: [Function], error: [Function] },
_eventsCount: 2,
_maxListeners: undefined,
_options:
{ protocol: 'http:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/api/singletons/get/intro',
method: 'GET',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: 'localhost',
port: '3000',
nativeProtocols: [Object],
pathname: '/api/singletons/get/intro' },
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'GET /api/singletons/get/intro HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nx-real-ip: 5.149.20.127\r\nsec-fetch-user: ?1\r\nsec-fetch-site: none\r\nupgrade-insecure-requests: 1\r\ncache-control: no-cache\r\nx-now-trace: zrh1\r\nx-now-deployment-url: BLURRED-NOW-DEPLOYMENT-URL\r\nx-zeit-co-forwarded-for: 5.149.20.127\r\naccept-language: en-GB,en-US;q=0.9,en;q=0.8,de;q=0.7\r\nx-forwarded-proto: https\r\nsec-fetch-mode: navigate\r\nx-forwarded-for: 5.149.20.127\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36\r\naccept-encoding: gzip, deflate\r\nx-now-id: clckl-1566116017296-db7c5240b52c\r\npragma: no-cache\r\nx-forwarded-host: BLURRED-NOW-DEPLOYMENT-URL\r\nconnection: close\r\nAuthorization: Bearer BLURRED-API-KEY\r\nHost: localhost:3000\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/api/singletons/get/intro',
_ended: false,
res: null,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Circular],
[Symbol(outHeadersKey)]: [Object] },
_currentUrl: 'http://localhost:3000/api/singletons/get/intro' },
response: undefined,
isAxiosError: true,
toJSON: [Function] }
END RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba
REPORT RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba Duration: 234.13 ms Billed Duration: 300 ms Memory Size: 3008 MB Max Memory Used: 97 MB
RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba Process exited before completing request
START RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff Version: $LATEST
2019-08-18T08:13:39.117Z f32bcba9-aea6-46d0-9269-c0544a211fff λ Cold start took: 339.379719ms
END RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff
REPORT RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff Duration: 115.83 ms Billed Duration: 200 ms Memory Size: 3008 MB Max Memory Used: 53 MB
I would expect now.sh or rather lambda to make the call and ssr my app.

ldapjs connecting to LDAP (ldap.forumsys.com) fails

Here is an online LDPA test server, http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/
So I did some simple script to test it but I am always getting unwanted response.
Here is my code:
const ldap = require('ldapjs');
const assert = require('assert');
// LDAP Connection Settings
const server = "ldap.forumsys.com";
const uid = "tesla"
const password = "password"; // User password
// Create client and bind to AD
const client = ldap.createClient({
url: `ldap://${server}`
});
// Search AD for user
const searchOptions = {
filter: '(uid=${uid})'
};
// client.bind(`uid=tesla,dc=example,dc=com`,password,err => {
// assert.ifError(err);
// });
client.search(`cn=read-only-admin,dc=example,dc=com`,searchOptions,(err,res) => {
assert.ifError(err);
res.on('searchEntry', entry => {
console.log(entry.object.name);
});
res.on('searchReference', referral => {
console.log('referral: ' + referral.uris.join());
});
res.on('error', err => {
console.error('error: ' + err.message);
});
res.on('end', result => {
console.log(result);
});
});
// Wrap up
client.unbind( err => {
assert.ifError(err);
});
And I am getting this back by running the app.js
SearchResponse {
messageID: 1,
protocolOp: 101,
controls: [],
log:
Logger {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
_isSimpleChild: true,
_level: 30,
streams: [ [Object] ],
serializers: { req: [Function], res: [Function], err: [Function] },
src: false,
fields:
{ name: 'ldapjs',
component: 'client',
hostname: 'will-ThinkPad-T440p',
pid: 17485,
clazz: 'Client' } },
status: 0,
matchedDN: '',
errorMessage: '',
referrals: [],
connection:
Socket {
connecting: false,
_hadError: false,
_handle:
TCP {
reading: true,
owner: [Circular],
onread: [Function: onread],
onconnection: null,
writeQueueSize: 0 },
_parent: null,
_host: 'ldap.forumsys.com',
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: false,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
data: [Function: onData],
close: [Object],
end: [Function: onEnd],
error: [Function: onSocketError],
timeout: [Function: onTimeout] },
_eventsCount: 7,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
allowHalfOpen: false,
_bytesDispatched: 79,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
[Symbol(asyncId)]: 8,
[Symbol(bytesRead)]: 0 },
attributes: [],
notAttributes: [],
sentEntries: 0 }
which does not contain any information around "Tesla"......
Could be that this section:
// Search AD for user
const searchOptions = {
filter: '(uid=${uid})'
};
Needs backticks like the url settings above? If this is a dynamic value, you should add those to transform it into a string literal, like:
// Search AD for user
const searchOptions = {
filter: `(uid=${uid})`
};
const searchOptions = {
filter: '(uid=${uid})'
};
The above section is incorrect.
Should be
const searchOptions = {
filter: `(uid=${uid})`
};
I see Gustav as already given the correct answer. But adding to that the reason is when using ' the variable replacement does not happen as you have expected. to build the string like this you need to use `
Anyway since you have written an LDAP test server, there are already written test servers to achieve that, for example, you can use
https://hub.docker.com/r/upekshejay/simple-ldap-test-server

MongoDB Aggregation SQL Union and SQL Exists like clause

I would like to make a MongoDB aggregation Query on data like this :
Collection A
{
_id : 1,
Active : true,
hasQuery : false,
Running : false,
}
{
_id : 2,
Active : true,
hasQuery : true,
Running : false,
}
{
_id : 3,
Active : true,
hasQuery : false,
Running : true,
}
{
_id : 4,
Active : true,
hasQuery : true,
Running : true,
}
{
_id : 5,
Active : false,
hasQuery : false,
Running : false,
}
{
_id : 6,
Active : false,
hasQuery : false,
Running : true,
}
This JSON data could be represented by a table architechture like this
Table A
PrimaryKey | Active | hasQuery | Running
1 | true | false | false
2 | true | true | false
3 | true | false | true
4 | true | true | true
5 | false | false | false
6 | false | false | true
If I apply the following query on the table :
select * from A where Exists(Select * from A where A.Running=true and A.hasQuery=true) and A.Running=false and A.hasQuery=false and A.Active=true
union
select * from A where not Exists(Select * from A where A.Running=true and A.hasQuery=true) and A.Running=false and A.Active=true
I get theses results :
In MongoDB :
{
_id : 1,
Active : true,
hasQuery : false,
Running : false,
}
{
_id : 2,
Active : true,
hasQuery : true,
Running : false,
}
{
_id : 5,
Active : false,
hasQuery : false,
Running : false,
}
in SQL :
PrimaryKey | Active | hasQuery | Running
1 | true | false | false
2 | true | true | false
5 | false | false | false
How to do the same thing with mongoDB aggregation ?
I managed to do it with that code :
db.test.aggregate(
{
$project:
{
RunningActiveRecordHasQuery:
{
$cond: { if: { $and: [ "$Running", "$hasQuery", "$Active"] }, then: true, else: false }
}
}
}
,
{
$match: {
RunningActiveRecordHasQuery : true
}
},
function (err, results) {
if (!err ) {
console.log (results.result);
match={}
if (results.length>0) {
match.AnyNotRunningActiveRecordHavingNoQuery=true;
} else {
match.AnyActiveRecordNotRunning=true;
}
db.test.aggregate(
{
$project:
{
_id: 1,
Running : 1,
Active : 1,
hasQuery : 1,
AnyNotRunningActiveRecordHavingNoQuery:
{
$cond: { if: { $and: [ {$eq: [ "$Running", false ] }, {$eq : [ "$hasQuery", false]}, "$Active"] }, then: true, else: false }
},
AnyActiveRecordNotRunning:
{
$cond: { if: { $and: [ {$eq: [ "$Running", false ] }, "$Active"] }, then: true, else: false }
}
}
}
,
{
$match: match
},
function (err, docs) {
}
)
}
}
)
It uses to aggregation to make things working.