Smartedit stays gray instead of showing login screen - sap-commerce-cloud

Our Smartedit stays gray for a long time before login. The Browserconsole shows an error:
ERROR Error: PromiseUtils: condition for promise resolution was never met
The error was from the "configuration" Request that result in a 401 Unauthorized (which should be normal, since the login was not yet done.
After multiple Full Reloads sometimes the login box appears. Sometimes also after a very long waiting, but we found no pattern yet. How can we prevent this?

Same problem here.
I feel like the 401 is not related to your problem. It also occures if the login screen works. In our case the problem seems to be a JS timeout because /smarteditwebservices/v1/i18n/translations/{locale} takes way to long to load. Dynatrace tells me that the time is used at 97% CPU for de.hybris.platform.util.GZIPServletFilter.doFilter . So I assume there is some super bad algorithm in place to zip the http response.
We have not solve the issue yet. But this seems like a good starting point for an analyis.

The 401 Error really seems not to be the problem, this is just a normal behavior if not user is logged in.
We got rid of the error using a workaround in our Apache2 reverse proxy. We add the following caching headers to the translation requests to make them better cachable:
<Location /smarteditwebservices/v1/i18n/translations>
ExpiresActive On
ExpiresDefault "access plus 1 hour"
Header set Cache-Control "max-age=1800, public"
</Location>
This makes our situation much better. The translation json takes very long to load (see answer of Johannes) and causes a race condition with the Smartedit Javascript code.

Related

Unable to get a random post from some subreddits with PRAW

i am trying to make a disord bot send images from reddit with this code (just to grab not to send)
def random_post(subreddit):
while True:
post = reddit.subreddit(subreddit).random()
if not post.stickied:
return post
it normally works fine but every once in a while i get this error
AttributeError: 'NoneType' object has no attribute 'stickied'
it only happens with certain subreddits.
This is a known issue on Reddit's end.
Some subreddits will refuse to give you a random submission. See praw-dev/praw#885 on GitHub.
On that issue, I went in depth about the cause. My findings were: When a subreddit's moderators uncheck the "allow this subreddit to be exposed to users in /r/all, /r/popular, default, and trending lists" checkbox in their subreddit settings, it prevents the subreddit from being able to provide a random submission. For example, at the time of this writing, https://reddit.com/r/wallpapers/random just redirects to https://www.reddit.com/r/wallpapers/ instead of to some submission.
In my personal opinion, this is a Reddit bug caused by confusion between /r/random (which redirects to a random subreddit) and /r/{subreddit}/random (which redirects to a random submission within a subreddit). As it stands, the checkbox affects both settings, when in my view it only makes sense for it to affect /r/random.
In the same GitHub issue, a Reddit developer chimed in to confirm that "the two behaviors are connected" and said that this behavior "isn't a bug per se." That was over two years ago and nothing has changed on Reddit's end since.
So what does this mean for you?
Unfortunately there's no good way to get around this. As you've discovered, for some subreddits, subreddit.random() returns None. This is noted in the documentation of the method. In your code, you should check that post is not None. In the case that it is None, it's up to you how to handle that. You could just return None, or perhaps you could use an alternate method to get a random submission, such as (for instance) getting 25 submissions from the hot listing and using random.choice() to select one.

Magento checkout page redirect to cart page

I am suffering a serious problems. The problem is that when i enter billing information, select shipping method and press continue button then it goes to cart page. But Cart is not empty. It should go to payment method step. I am used magento 1.8.1.0 version. When i click on continue buttom my ajax is running . I get the following error in console
"NetworkError: 500 Internal Server Error - http://www.themeatboutique.com.au/shop/checkout/onepage/saveShippingMethod/"
All things are working fine before 4-5 days.
Finally I found about the problem. The problem is that $this is not working in setTemplate file. Not Sure why it is not working
So Can anyone please tell me the solution
In my experience, the most common cause of 500 Internal Server Error on a Magento page that was previously working is a minor typographical mistake that affects syntax enough to make the .php impossible to compile into op-code, therefore, impossible to render, therefore, impossible to serve to the browser.
On the checkout page, such an issue in any of the code that is collated into the standard onepage "pseudo-view" you're using could produce that result at that step. It sounds like all rendered well up to the step following shipping, so your syntax error is most likely in one or the other of those files that creates the view for those two steps, and is most likely in the one following the shipping method.
Look for the usual suspects, a single-quote / double-quote mismatch, a stray line of code missing a semi-colon, a nested array with mismatched parentheses, etc.
If it is none of these, check your /var/system.log and /var/exception.log files for clues.
It is almost always frustratingly simple when you find it.
Happy hunting!

Error with GET request URL, is it a URL issue or the returned info?

I'm trying to retrieve some stuff from a server (can't really go into much detail), but I've run into an issue which is solved by commenting out some stuff in a string being used as the place to hit.
The situation is as follows:
The URL I want to hit is
http://example.com/api/statistics/installations?version=1.0&type=prod
I get errors with this (based on the stuff being returned not being as expected), however using this works:
http://example.com/api/statistics/installations
Just without the refining flags of version and type.
Now, I'm new to working alongside servers, so I was wondering if perhaps the first URL is malformed towards the end or something?
Thanks to anyone who answers, even if it's just clarification the URL is correct at least I know where the problem lies afterward.
The URL is fine in that format, the issue was on the other end.

Possible reasons for a browser executing GET rather than post

One of our most common error situations in a web application is that a user executes a GET request where the form should have submitted a POST.
I realize that the most likely case is that they got to the page (by way of a POST) and then clicked in the address bar and hit enter.
The question is, are there other less obvious ways that this could happen (print previews/back button, etc)?
We have never been able to consistently repeat the problems. The problems for different users and different pages nor do they happen very often (maybe once a week).
EDIT:
There is no data submitted with the GET request and therefore the processing page crashes out.
I was having a similar issue, although it doesn't sound like this was exactly yours. I had a form that was being submitted via ajax and shouldn't ever use the default submit. Now and then I was receiving errors from a GET done on the form. It shouldn't be possible to submit this form; however, certain versions of Safari for Mac were submitting it on enter. I just added a jquery form.submit() catch on it to prevent the default functionality. I also set the action to a page that wouldn't result in error (in case of lack of javascript).
As you said your problem is intermittent, so having a problem in form method set as get instead of post can be overruled but yes you are right, that if user presses enter in address bar it would be a get request and back button request always depends upon the last request made, if it was a post then any good browser will prompt you about resubmission and if it was get then no prompt, page will be bought back(may be from cache).
May be you can use Firebug (track requests in .net tab)or Fiddler and do some tests with different users/pages if you can reproduce it, its simply pressing enter in address bar.
Edit:
And also get is always supposed to 'retrieve information' so if browser is missing something or need something it will be a get but again check in IIS log for those get requests and try them in browser,if they contains query string for viewstate and eventvalidation, then they are really mis-formed request from post to get, if form method is not explicitly set to get.
I believe that an answer to the question "what are reasons for a browser executing GET rather than POST" does not help to solve the problem of receiving a GET on a form where you expect the a GET. But: To answer that question I would simply say that you receive an GET because the browser sends an GET and you can send a GET on any page where you can send a POST. On the other hand, if the user uses the form the browser sends a POST. Thus your server has to be prepared to handle the GET and it should handle the GET in the same manner as a POST with invalid parameters. My suggestion:
If you receive a GET, display the form again.
If you receive a POST with invalid data, display the form again and notify the user that he has to enter the data in a specific way.
Maybe a trivial answer, but that's what I would do. Don't know if it adds to the discussion.
Wrong, the most obvious reason why you get a GET instead of a POST is that because you're doing a GET instead of a POST.
A less obvious reason is you forgot to specify method="post" in one of your forms. The HTML standard specifies that the default method is GET, so if you want to POST, you must specify method="post" explicitly.
Scrutinize all of your tags and make sure all of them explicitly specify method="post".
EDIT: When you click on the address bar and pressed enter, yes it's true that the browser will GET a page, but your form wouldn't be submitted that way since the browser treats the URL similar to how a copy-pasted URL would be: a new session without any additional information sent to the server (except cookies).

IE secure and unsecure items issue

I'm trying to get rid of the error pop-up window that appears in IE saying "page contains both secure and non-secure items". I have made sure all the links are pointing to https:// rather than http://. I have also looked at the fiddler and firebug logs to see that all the requests are being made to https:// links only.
Here's a similar question asked on SO : IE - "This page contains both secure and non-secure items"
The guy whose answer was accepted hit right on target. I wish I knew how he debugged to narrow down to that solution.
Any help is appreciated.
Thanks
You don't need to actually load a resource in order to trigger the warning, a reference is all it takes. The <object> used to load a Flash applet is enough (if you reference the HTTP URI for the Flash Plugin).
The easiest thing to do is to open up the source and search for 'http:' with your editor. If that doesn't turn up anything, do the same with the output of document.getElementsByTagName('html')[[0].innerHTML.
You could either do a top-down or bottom-up approach to try to track down the issue. Top-down is where you'd start commenting out stuff until it goes away while in the bottom-up case you strip out everything and then slowly start adding back in things like Flash, Javascript, and CSS as it may be some include or function that is the culprit.

Resources