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

404 Errors on certain profiles #532

Open
jhmullen opened this issue Apr 3, 2019 · 1 comment
Open

404 Errors on certain profiles #532

jhmullen opened this issue Apr 3, 2019 · 1 comment
Assignees

Comments

@jhmullen
Copy link
Collaborator

jhmullen commented Apr 3, 2019

@WellisonRodrigues

@alexandersimoes indicated to me that for some users, the permalinks are not working (example here). Here are a few of my thoughts on the issue to give you some places to get started.

Where to start

Firstly, the component to start in would be Share.jsx. This is where the permalink pages are rendered. There are only two places in that file where the 404 could come back:

https://github.com/CodeLifeOrg/codelife/blob/master/app/pages/Share.jsx#L65-L67

Line 65 and 67 show you the places where the <Error> page returns. In the first case, it is if neither a project nor codeblock was found for the need request (see below for more info on need) . In the second case, we access the first element of that content array, which should contain the html content. If it doesn't, we return a 404.

More on Needs

A need is a special request made by canon which says "Before you render this page, promise me that you will make these requests." As you can see, given the username and filename from the url, we attempt to hit our internal API and fetch this user's content.

Interestingly, for this user's content, these API endpoints are actually functioning. If you look here and here, these are the raw API results, and the data is indeed coming through.

Possible explanations

So, it the API call is functioning, then why isn't the page rendering? I have two potential ideas for why this might be the case:

  1. Something about the accent in the username is causing the fetchData function in the need to fail. This would mean that there could potentially be some error in canon that is not building the URL correctly. If this is the case, we would be able to issue you a fix for this, or at least instructions for a workaround or patch.

  2. Something is wrong with the pathing check we are doing here. As you can see, this line of code checks the url and asks, "are trying to render a codeblock or a project?" The answer to this question is then used here to determine which data to use. If for some reason this path check is failing, it will default to a project. When we try to find a project with this filename, it won't be found, because we're SUPPOSED to be looking for a codeblock.

Next steps

The first thing to do would be to add some console.log:

  • contentType - is this variable properly being set to "codeBlocks"? What is the value of the pathname variable when we check it?

  • codeblockContent and projectContent - what are the value of these variables? Is our content coming through at all? I would be interested to learn whether it's line 65 or line 67 that is the culprit for rendering that 404.

Conclusions

If you'd like to post the output of those console logs to this issue, I can continue to give you my thoughts on what the root cause is.

Best of luck,

Jimmy

@WellisonRodrigues
Copy link
Collaborator

WellisonRodrigues commented Jul 2, 2019

I've been checking for the above variables, and so it looks like the variable projectContent is returning empty object

image

I will continue analyzing this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants