fix: add missing build-time env vars#7063
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds the any-ascii runtime dependency; consolidates Netlify default constants at module scope; sets SITE_ID and SITE_NAME via nullish coalescing in getGeneralEnv; adds an internal slugify helper; derives URL from ssl_url with a fallback and builds DEPLOY_PRIME_URL using a slugified branch; expands the read-only env allowlist to protect deployment-related variables; updates many test snapshots and a few tests to reflect the new env fields and normalized DEPLOY_PRIME_URL values. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request adds or modifies JavaScript ( |
| "severity": "info",␊ | ||
| "unhandled": false,␊ | ||
| "location": {␊ | ||
| "buildLogs": "https://app.netlify.com/sites/site-name/deploys/0",␊ |
There was a problem hiding this comment.
Should this be produced for those "mock" values?
There was a problem hiding this comment.
I think, yes. These lines are coming from here:
build/packages/build/src/error/monitor/location.js
Lines 13 to 21 in 777589c
DEPLOY_ID existed, SITE_NAME didn't. Now SITE_NAME also exists resulting in the line existing. Based on the code, I think it makes sense to have these lines printed.
There was a problem hiding this comment.
I am a bit conflicted on this - not sure if one is worse then the other, but that buildLogs url won't ever work, so that's why I was wondering wether we should return undefined for the mocked values case (as in expand conditions that are checked to avoid constructing url if values are mocked)
But I guess same can be same about mocked SITE_NAME and all the others, that they won't work either in practice - so probably matter of degree on what make sense to "mock" and what does not 🤔
Currently, when building with CLI without logging into ay account, the following variables get populated:
Notice how we're missing some other variables like:
This PR adds those variables. Also, for the
DEPLOY_PRIME_URL, we set thebranchas it is. This PR also slugifies the branch name, so that branch like:foo/barcould becomefoobar.