-
Notifications
You must be signed in to change notification settings - Fork 352
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
feat(deploy): print edge function logs url #6851
Conversation
`name` was always `nil` so it effectively never really existed
This could be useful, but it also makes the feature easier to test. :)
logs: results.logsUrl, | ||
function_logs: results.functionLogsUrl, | ||
edge_function_logs: results.edgeFunctionLogsUrl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have suffixed these with _url
but since logs
was already named logs
I erred toward internal consistency 😞.
}) | ||
await builder.build() | ||
|
||
const deploy = await callCli(['deploy', '--json', '--dir', 'public', '--prod'], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun fact: this is the very first test coverage of ntl deploy --prod
😬😬😬
Follow-up to #6851. You can see here it says "Show logs for deploy...": https://app.netlify.com/sites/hydrogen-advanced-caching/logs/ edge-functions?scope=deployid:6705473738103f2856071dbd. This doesn't work with `?scope=deploy:` This is a bit of a footgun since the Functions log URL takes `deploy:` but the Edge Functions log URL takes `deployid:`.
Follow-up to #6851. You can see here it says "Show logs for deploy...": https://app.netlify.com/sites/hydrogen-advanced-caching/logs/ edge-functions?scope=deployid:6705473738103f2856071dbd. This doesn't work with `?scope=deploy:` This is a bit of a footgun since the Functions log URL takes `deploy:` but the Edge Functions log URL takes `deployid:`.
Summary
The
netlify deploy
command prints the build logs URL and the function logs URL:It's inconvenient and inconsistent that this doesn't also include a link to edge function logs. So this PR adds it.
Changes
4d5ebca: add missing types to
printResults
and neighbouring codebee888c: fix issues uncovered by above
name
in the JSON output was coming from a field that did not exist, so it was always undefined (andundefined
values are omitted when JSON stringifying), so I just removed it, as it's effectively never truly existedsite_name
field which is working as intended.site_id
never worked (or at least hasn't for some time) as it was reading from a field that didn't exist. I fixed this one.8bee1a9: add edge function logs URL to pretty output
Example:
aed9afe: add
function_logs
andedge_function_logs
to--json
outputIt wasn't consistent that these weren't included in the JSON output. These also could be useful to users. But mostly it allowed me to more easily add test coverage (none of the printed URLs — neither pretty nor json — had test coverage).
Example before:
Example after:
Future improvements
💡 We should only include the function logs URL when the deploy included >0 functions and only include the edge function logs URL when the deploy included >0 edge functions.