fix(ssg): pass SSG_CONTEXT to forGetInfoURLRequest#4810
Merged
yusukebe merged 2 commits intohonojs:mainfrom Mar 23, 2026
Merged
fix(ssg): pass SSG_CONTEXT to forGetInfoURLRequest#4810yusukebe merged 2 commits intohonojs:mainfrom
yusukebe merged 2 commits intohonojs:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4810 +/- ##
==========================================
- Coverage 92.83% 92.82% -0.01%
==========================================
Files 177 177
Lines 11642 11642
Branches 3466 3466
==========================================
- Hits 10808 10807 -1
- Misses 833 834 +1
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
@yuintei Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(ssg): pass SSG_CONTEXT to forGetInfoURLRequest
Summary
Pass
SSG_CONTEXTtoforGetInfoURLRequestfetch (infetchRoutesContent) so thatisSSGContext(c)returnstrueanddisableSSG()works as intended.Details
In
fetchRoutesContent,SSG_CONTEXTis missing in theforGetInfoURLRequestfetch, while it is passed correctly in thereplacedUrlParamfetch.As a result, during the build process,
isSSGContext(c)incorrectly returnsfalse.disableSSG()falls back tonext()instead ofc.notFound().c.envisundefinedduring the Vite build, causing the following errors in every route:I had to add manual guards like
if (!c.env) return next()orif (!c.env) return c.notFound()to everyapp.use()andapp.get()that accessesc.env, which is whatdisableSSG()should be handling automatically.With this fix, I verified that the errors above are resolved and the manual guards are no longer needed. All existing tests pass with this change.
To reproduce,
c.env(e.g.basicAuthwithc.env.ADMIN_PASSWORD)disableSSG()that accessesc.envbindings (e.g.c.env.d1)@hono/vite-ssgortoSSG