Naguel

I'm Nahuel, and these are my work experiences, ideas and thoughts as a web developer working on the eCommerce industry.

Magento and FORBIDDEN/12/index read-only / allow delete (api)

Magento and FORBIDDEN/12/index read-only / allow delete (api)

If you are unlucky enough to be reading this article it means that you are seeing that error when trying to reindex Magento.

ElasticSuite Category Indexing index process unknown error:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}
ElasticSuite Thesaurus Indexing index process unknown error:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}

This happens because you are probably running out of disk space and Elasticsearch turns itself into read only mode because, well, there's no more space to do stuff.

In order to get out of this situation, you need to first disable that Elasticsearch feature of switching to read only mode (otherwise it will happen again) by running the following...

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{"persistent":{"cluster.routing.allocation.disk.threshold_enabled":false}}'

...and then get Elasticsearch out of the read only mode with the next command:

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

Besides this, you'll need to do some disk clean up to recover some space.

Missing query string parameters when using Varnish on Magento

Missing query string parameters when using Varnish on Magento

I had this weird issue a time ago with a simple task that consisted on getting some query string parameters from the URL, from the PHP $_GET variable, to store them in Magento after the Customer places the Order.

What sounded like a very straightforward task got complicated because the $_GET variable was missing some of the those parameters I needed to save.

Debugging this issue made me realise that all the missing parameters where those starting with utm. I was literally going to this example URL...

http://example.com/test.php?utm_source=Source&utm_medium=Medium&utm_content=Content&utm_term=Term&siteId=42689&siteName=naguel.com

...to get the following incomplete output when printing the $_GET variable:

The cause of this issue was Varnish's recommended VCL configuration for Magento that includes the following inside the sub vcl_recv {}.

# Remove all marketing get parameters to minimize the cache objects
    if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") {
        set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
        set req.url = regsub(req.url, "[?|&]+$", "");
}

That was literally subtracting all marketing-related GET parameters from the URL, including those starting with utm_.

The solution is quite simple: remove the utm_[a-z]+ from the if conditional and restart Varnish to apply the changes.

UTM parameters?

UTM stands for "Urchin Tracking Module" (who cares, right?), which are basically marketing-related parameters to track marketing campaigns, and to know how people interact with the site.

In my case I was dealing with them because of a Rakuten integration with Magento.

More information on what they are and what we can do with them can be found on "The Ultimate Guide to Using UTM Parameters" post from Neil Patel's blog.

A few soft skills interview questions to get to know the candidate

A few soft skills interview questions to get to know the candidate

For job interviews to fill a technical role it's obvious that the questions needs to be, well, technicals, with focus on the hard skills questions aiming to know the candidate's knowledge in a specific framework, code language, software, etcetera.

But the attitude is very very very... very much... important. I said it before:

Everybody has access to the same documentation, to the same in-house training programs, to the same software, to everybody's code, to basically the same people to ask questions and to learn from... and what's set the difference between someone progressing in his or her line of work and someone stuck is the personality each developer has.

Soft skills related questions allow you to get to know the human you are interviewing, having in mind that you'll share with that person more than some lines of code if you ended up offering the job.

It also humanise the interview. If you pay attention people are usually tense answering the technical questions but when you throw in a soft skills one candidates relax and enjoy the conversation created around that question.

Developer’s work success being too much about personality rather than hard skills
Maybe what’s set the difference between someone progressing in his or her line of work and someone stuck is the personality each developer has.

At my current job we have a few very good soft skills questions I would like to share now in case you find them useful (our interviews are for web developers so the questions, while soft skills related questions, orbit around that role).

What do you think makes a good developer?

I personally expect whatever answer that's not about code, software, or any other hard skill stuff.

People usually talks about the ability of being flexible, passionate about it, the importance on working as part of a team, etcetera. Still some candidates mention hard skill stuff not covered before in the interview such as testing, and that's fine.

What do you think makes a good manager?

I like this one because it's a chance for the candidate to talk about others, and it's expected that they think of their current boss (obviously).

The answer will give you an idea of how the candidate works on a team structure where somebody is on a position above them. And at the same time it will hint you if the candidate will do well with the current managers at your company.

I like the answers about leadership and motivation.

What do you think you would add to the team if you were to get the job?

This is the polite version of "Why do you want this job besides money?".

I like this one because it forces the candidate to summarise what's their contribution to the team. And it's important to emphasise the team in the question, like you are not just adding something to the company but adding something to a team made of real humans.

What would you expect from the team if you were to get the job?

In opposition to the previous one, this is the time for the candidate to tell us how they see themselves after any period of time as part of a new team.

Again, we are asking about the team, not the company, so we try to keep it human while guiding the candidate into giving us something not technical.

If you were to organise a work social night out, what would you plan?

This always takes the candidates by surprise. They are thinking about PHP, VueJS, code reviews, pull requests and out the sudden they need to think about beers (because beers is the right answer to a social night out plan).

What do you like to do when you aren't coding?

There's no better question than this one to force the candidate to stop talking about hard skills and say something about their personal life (as much as they want, don't force people into talking about their personal life on a job interview).

It is also fun to learn about others people hobbies.