Skip to content

Static generation does not render some breadcrumb segments #174

Open

Description

@markzegarelli

We're using SSG for the production deployment of our site, and working locally in the standard, non-static mode.

I've noticed there are sections of our site in which the last part of breadcrumb doesn't render. Example here. Production builds run on Vercel, following the instructions in your docs.

The same page running locally displays the breadcrumb as expected.
Screenshot 2024-07-25 at 10 16 38 AM

Environment
Application Name: Amplitude Documentation
Laravel Version: 10.40.0
PHP Version: 8.2.16
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: amplitude-docs.test/docs
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 2
Sites: 2 (Amplitude Documentation, Amplitude Documentation - Japanese)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.3.0 PRO

Statamic Addons
pecotamic/sitemap: 1.4.7
statamic/ssg: 3.0.0

Activity

  1. markzegarelli commented on Oct 16, 2024

    @markzegarelli
    Author

    This is still an issue for us. This issue seems to happen on some collections, but not others, and is happening more often.

    We don't see any errors in the SSG output, and have updated Statamic to 5.31.0 and SSG to 3.0.2.

    Additionally, running ssg locally on my machine produces no breadcrumbs at all.

  2. jesseleite commented on Dec 6, 2024

    @jesseleite
    Contributor

    Additionally, running ssg locally on my machine produces no breadcrumbs at all.

    Hmm, I pulled down your repo and was able to generate breadcrumbs locally on your site fine 🤔

    CleanShot 2024-12-06 at 16 53 06

    That said, I'm on PHP 8.3. I suspect it may have more to do with how you're configuring your .env and deploying your /docs.

    For example, I was getting 404s on nested pages until I tweaked APP_URL in my .env, from what you had in your .env.example:

    APP_URL=http://amplitude-docs.test/docs
    

    Which I had to change to:

    APP_URL=http://amplitude-docs.test/
    

    I'm curious to know more about what you have set for that in your .env locally, versus where you're running ssg:generate for production?

    This issue seems to happen on some collections, but not others, and is happening more often.

    If you take a collection or page that doesn't render properly, does it consistently not work across multiple generations? Or is there a randomness to when it does or doesn't work, on a specific page?

  3. markzegarelli commented on Dec 6, 2024

    @markzegarelli
    Author

    Thanks for the response @jesseleite!

    I was able to reproduce your results locally, which is awesome. I think I had included /docs in the APP_URL when using Vite, but obviously don't need that anymore.

    I tried to replicate this setting in Vercel for our production build, APP_URL=https://amplitude.com, but it didn't seem to help. For example, here's the page from the screenshot.

  4. jesseleite commented on Dec 6, 2024

    @jesseleite
    Contributor

    @markzegarelli Hmm, assuming everything is working as expected locally, I'd need to know more details on your vercel env/config.

    I can try playing with a vercel deployment next week as well.

  5. markzegarelli commented on Dec 7, 2024

    @markzegarelli
    Author

    Sure, here's the build script.

    Let me know what other details will be helpful for you.

  6. markzegarelli commented on Jan 7, 2025

    @markzegarelli
    Author

    Hi @jesseleite, I hope you had a nice holiday period.

    I was poking around with this a bit more today, and noticed that on Vercel, their system environment variables don't include the protocol.

    However, when I set my APP_URL to match, SSG errors out here, because it expects the scheme to be present.

    I don't know if this could actually cause the issue, but it's a difference I noticed between my dev environment and prod.

    Edit: I tried using the Vercel provided URL, but that didn't help.

    As for the collection variability, it's consistent across generations.

    For example, this page has complete breadcrumbs (collection), whereas this page at the same level, but in a different collection, doesn't.

  7. jesseleite commented on Jan 15, 2025

    @jesseleite
    Contributor

    Hey @markzegarelli, I apologize for the delay here...

    I don't know if this could actually cause the issue, but it's a difference I noticed between my dev environment and prod.

    Good to know!

    Also, how are you managing to even get a successful build/deployment in the first place? I'm realizing that our suggested build script is obviously out of date, can't get Vercel to build at all here...

    image

  8. markzegarelli commented on Jan 15, 2025

    @markzegarelli
    Author

    @jesseleite I'm using Node 18 for this project, which Vercel says uses the legacy build image. My guess is that was the default when the instructions were written.

    The build image for Node 20 or 22 uses the Amazon Linux 2023 repository, which doesn't include amazon-linux-extras.

  9. jesseleite commented on Jan 15, 2025

    @jesseleite
    Contributor

    @markzegarelli Oh wow, okay I'm able to reproduce the issue locally now. It all depends on cache/stache state when running ssg:generate.

    We're not sure this is a problem with the ssg, but possibly a bug in core. Will leave this open for now, but in the meantime you should be able to workaround this by adding php please stache:warm right before ssg:generate in your build.sh script...

    CleanShot 2025-01-15 at 16 09 23

    I'm using Node 18 for this project, which Vercel says uses the legacy build image. My guess is that was the default when the instructions were written.

    Also that clears things up regarding that error, thank you. We'll look into updating our instructions for the newer vercel build image!

  10. markzegarelli commented on Jan 15, 2025

    @markzegarelli
    Author

    Amazing! Thanks @jesseleite!

    Fwiw, I did get an error in the build related to the spinner that displays in the terminal while the stache is warming, but it did not impact the output.

    Cheers!
    Screenshot 2025-01-15 at 1 27 41 PM

  11. jesseleite commented on Jan 15, 2025

    @jesseleite
    Contributor

    Oh interesting. Does running with -n -q flags suppress that spinner error?

  12. markzegarelli commented on Jan 15, 2025

    @markzegarelli
    Author

    👍 Yup! That cleaned everything up. Thanks again!

  13. removed their assignment
    on May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions