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

fix: Internal Server Error when invalid vaults #195

Merged
merged 3 commits into from
May 23, 2023
Merged

Conversation

karelianpie
Copy link
Member

Description

When Googlebot, or a user goes to an invalid /vaults route -- be it an invalid chainID or an invalid vault address the app crashes with a 500 Internal Server Error, i.e. https://yearn.finance/vaults/invest/0xA74d4B67b3368E83797a35382AFB776bAAE4F5C8

The way to solve this is to validate both dynamic routes, chainID and address and only allow through the valid routes. The ones that do not have a valid chainID nor address should return 404 so that Google's crawler stops crawling them.

Related Issue

Fix #194

FetchError__invalid_json_response_body_at_https___ydaemon_yearn_finance_invest_vaults_0xA74d4B67b3368E83797a35382AFB776bAAE4F5C8_hideAlways_true_orderBy_apy_net_apy_orderDirection_desc_strategiesDetails_withDetails_strategiesRisk_withRisk_s

Motivation and Context

Prevent 500 Internal Server Error and gracefully return 404 for invalid routes

How Has This Been Tested?

Ran locally, went to invalid routes and observed 404 and valid routes working as expected

Screenshots (if appropriate):

Screenshot 2023-05-23 at 9 50 56

@karelianpie karelianpie requested a review from Majorfi May 23, 2023 06:51
@karelianpie karelianpie self-assigned this May 23, 2023
@vercel
Copy link

vercel bot commented May 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yearnfi ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2023 7:49am

Copy link
Collaborator

@Majorfi Majorfi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good initiative!
One more 500 to fix!

pages/vaults/[chainID]/[address].tsx Outdated Show resolved Hide resolved
@Majorfi Majorfi added this pull request to the merge queue May 23, 2023
Merged via the queue into main with commit ce0d196 May 23, 2023
@Majorfi Majorfi deleted the fix/vault-page-500 branch May 23, 2023 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🟢 Done
Development

Successfully merging this pull request may close these issues.

Bug: 500 Internal Server Error
2 participants