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

Author page will refuse to render a 404 #1323

Open
binyamin opened this issue Feb 3, 2022 · 2 comments
Open

Author page will refuse to render a 404 #1323

binyamin opened this issue Feb 3, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@binyamin
Copy link
Member

binyamin commented Feb 3, 2022

Summary

Given a URL https:///11ty.dev/authors/:name/ - if :name doesn't exist, or :name contains uppercase characters, the serverless function fails.

Details

When there's a trailing slash, the HTTP status code is 500. The response is a JSON object, instead of HTML. The object looks like this:

{
  "error": "json.filter is not a function"
}

When the trailing slash is omitted, the status code is 404, and the object looks like this:

{
  "error": "No matching URL found for /authors/binyaminGreen in {\"/authors/:name/\":\"./src/authors/author-pages.md\"}"
}

Notes

This may be a problem with the internal Serverless plugin, but I decided to start from the beginning of the chain.

@binyamin binyamin changed the title Author page will refuse to render a 404 [wip] Author page will refuse to render a 404 Feb 3, 2022
@binyamin binyamin changed the title [wip] Author page will refuse to render a 404 Author page will refuse to render a 404 Feb 3, 2022
@binyamin
Copy link
Member Author

binyamin commented Feb 3, 2022

@pdehaan any thoughts?

@pdehaan
Copy link
Contributor

pdehaan commented Feb 3, 2022

Seems unfortunate.

  • [200] https://www.11ty.dev/authors/binyamingreen (lowercase)
  • [200] https://www.11ty.dev/authors/binyamingreen/ (lowercase trailing /)
  • [404] https://www.11ty.dev/authors/binyaminGreen (uppercase char)
    • { "error": "No matching URL found for /authors/binyaminGreen in {\"/authors/:name/\":\"./src/authors/author-pages.md\"}" }
  • [500] https://www.11ty.dev/authors/binyaminGreen/ (uppercase char, trailing /)
    • { "error": "json.filter is not a function" } 
  • [500] https://www.11ty.dev/authors/usernotfound/ (lowercase, no user found, trailing /)
    • { "error": "json.filter is not a function" } 

Not sure if there's a way when using serverless to force the :name path to be lowercase. And intercept missing users and redirect or show a more meaningful error.

I honestly haven't tried playing w/ serverless paths yet, but it's high on my list now that 1.0 is released. ❤️

@zachleat zachleat added the bug Something isn't working label Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants