unexpected behavior of apollo link retry on 400 error [closed] - apollo

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
description: Attempt an operation multiple times if it fails due to network or server errors.
I have used apollo-link-retry to retry calls on the occurrence of server errors(5xx).
But when 400 error(bad request) is occurring it retrying which is expected to retry in server error only.
Does network error means all client errors(4xx) and server errors(5xx)?
How to stop retrying on errors other than 5xx?

In the context of Apollo Client, there are two types of errors -- GraphQL errors (those returned inside the errors array in the response) and network errors. Any request that returns a status other than 200 is considered to have encountered a network error. The default RetryLink configuration is not that granular -- it only cares about whether a network error occurred, not what kind of error occurred. If you want to not retry on certain errors, provide a retryIf function to the attempts configuration as shown in the docs:
attempts: {
retryIf: (error, _operation) => {
// return true or false depending on the properties on error
}
}
})

Related

Why is the Ropsten test faucet not working? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
this is the error I am getting. I tried doing it again and again but it doesn't work.
Error: 500 {"error":"[ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"message":"Too Many Requests","data":{"originalError":{}},"stack":"Error: Too Many Requests\n at eval (/www/node_modules/web3-provider-engine/subproviders/rpc.js:52:23)\n at Request.eval [as _callback] (/www/node_modules/web3-provider-engine/subproviders/rpc.js:54:11)\n at Request.self.callback (/www/node_modules/request/request.js:186:22)\n at Request.emit (events.js:315:20)\n at Request.eval (/www/node_modules/request/request.js:1155:10)\n at Request.emit (events.js:315:20)\n at IncomingMessage.eval (/www/node_modules/request/request.js:1077:12)\n at Object.onceWrapper (events.js:421:28)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (internal/streams/readable.js:1327:12)"}}'"}
this is the error i am getting when I try to transfer test ethereum to my metamask wallet from the test faucet https://faucet.metamask.io/
You can use other faucet for Ropsten testnet like these:
https://faucet.dimensions.network/
https://faucet.egorfine.com/
https://testnet.help/en/ethfaucet/ropsten
https://ropsten.faucet.kr/
https://faucet.rpanic.com/

How to handle a 400 error with Ember Data (2.4.0-canary)

I can't figure out if my problem has to do with my query or my response or something else.
In my route I'm using a queryRecord:
model(params) {
return this.store.queryRecord('invitation', {
'invitation_token' : params.invitationToken
});
},
I'm properly receiving on the server side but I'm testing the case where the invitation token no longer exists. Therefore, the server is returning a 400 with a json payload which has an explanation of the error.
{"error":"Error finding invitation"}
But back on the ember side I'm just getting two errors (really it is just one).
Error while processing route: accept-invitation Ember Data Request GET /api/users/invitation returned a 400
Error: Ember Data Request GET /api/users/invitation returned a 400
It used to be (under Ember 2.2.1):
Error while processing route: accept-invitation Adapter operation failed Error: Adapter operation failed
Error: Adapter operation failed
What am I supposed to be returning from the server in the case that the token wasn't found? These messages makes it looks like something unexpected happen within Ember.
I'd assume that a 400 would tell Ember that there was an error, and it would go to the error state for the route. But instead it goes to the error state at the application level and spits out these error messages in the log.
I'm expecting the server to return a 400, so I'm not sure why Ember is complaining. What should I be returning and how should I properly handle this?
I believe that your application should be returning a response that is formatted differently. As per the JSON API specification,
Error objects MUST be returned as an array keyed by errors in the top
level of a JSON API document.
The specification also specifies that the following members, among others, may be provided (see the link for the full list).
title: a short, human-readable summary of the problem that SHOULD NOT
change from occurrence to occurrence of the problem, except for
purposes of localization.
detail: a human-readable explanation
specific to this occurrence of the problem. Like title, this field's
value can be localized
status: the HTTP status code applicable to this problem, expressed as
a string value.
If you try returning something along the lines of what is below, how does the tooling behave?
{
"errors": [
{
"status": "400",
"title": "Error finding invitation"
}
]
}

how to use boto to get aws sqs message already in flight [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I tried boto api and seems that no api can get message number already in flight? Does anyone give me a hint how to get this number?
To find the messages in flight or any of the other attributes of an SQS queue in boto, you need to do this:
import boto.sqs
c = boto.sqs.connect_to_region('us-east-1')
queue = c.lookup('myqueue')
attr = queue.get_attributes()
This will a python dictionary that looks like this:
{u'ApproximateNumberOfMessages': u'0',
u'ApproximateNumberOfMessagesDelayed': u'0',
u'ApproximateNumberOfMessagesNotVisible': u'0',
u'CreatedTimestamp': u'1412270007',
u'DelaySeconds': u'0',
u'LastModifiedTimestamp': u'1412270007',
u'MaximumMessageSize': u'262144',
u'MessageRetentionPeriod': u'345600',
u'QueueArn': u'arn:aws:sqs:us-east-1:723405645490:16ac1da3-564c-43aa-8dcb-4db41ece50ea',
u'ReceiveMessageWaitTimeSeconds': u'0',
u'VisibilityTimeout': u'30'}
I believe the ApproximateNumberOfMessagesNotVisible is equivalent to the in-flight statistic reported by the console.

How to communicate with Firefox using C++? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am on project right now which is a very simple parental control software, but, I want to know what is the url requested in firefox to take respond based on it ... if you may help because I don't know how to let my software know what is the url requested by firefox .. How to do that?
I have to use C++ in most of my software.. but if there are better language to do this task please advice me
In Firefox you need to use XPCOM component called nsIHTTPChannel. This script below will block abort all rqeuests to google. The channel is opened but aborted before opening connection to server.
var {classes: Cc, results: Cr, utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
var httpRequestObserver =
{
observe: function(subject, topic, data)
{
var httpChannel, requestURL;
if (topic == 'http-on-modify-request') {
httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
requestURL = httpChannel.URI.spec;
if (/google\.com/.test(requestURL)) {
httpChanel.cancel(Cr.NS_BINDING_ABORTED);
}
return;
}
}
};
Services.obs.addObserver(httpRequestObserver, 'http-on-modify-request', false);
//Services.obs.removeObserver(httpRequestObserver, "http-on-modify-request", false); //run this to remove observer
Can I suggest an alternative approach? Instead of writing an extension for Firefox and an extension for Chrome and an extension for IE... listen on the OS network interfaces for traffic and block undesirable URLS.
This is traditionally the job of a firewall. Using an existing solution will provide the most efficient means of solving your problem. I'm not familiar with the capabilities of the built in Windows firewall or 3rd party alternatives but something like this would be trivial with iptables (Linux).

Ember data 1.0.0: rollback after unsuccesfull save does not revert properties [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I have the following behaviour with Ember Data 1.0.0 Beta 2:
Rollback of data changes (without first trying to save the changes):
- all data properties are restored to the previous version
- all flags in correct state
Rollback of data changes after an attempt to save, but the save returned a 422 error:
- none of the data properties are restored
- isError flag remains true
I would expect that also in the second case the properties are set back to the previous state and that the isError flag is cleared.
This is how I revert:
cancel: function () {
var author = this.get('model');
author.rollback();
},
Is this a known issue ?
thx