-
Notifications
You must be signed in to change notification settings - Fork 365
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
fix: gracefully fail Edge Functions in case of deno binary issues #4685
fix: gracefully fail Edge Functions in case of deno binary issues #4685
Conversation
📊 Benchmark resultsComparing with 9dffdb0 Package size: 226 MB⬇️ 0.00% decrease vs. 9dffdb0
Legend
|
Co-authored-by: Daniel Tschinder <231804+danez@users.noreply.github.com>
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.
…b.com:netlify/cli into fix/gracefully-fail-in-case-deno-binary-issue
@eduardoboucas suggestions applied and as per usual review reset 😅 |
[headers.Passthrough]: 'passthrough', | ||
[headers.RequestID]: generateUUID(), | ||
[headers.IP]: LOCAL_HOST, | ||
try { |
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'm sorry if this wasn't clear in my previous comment, but I was trying to suggest that you only wrap the Promise.all
call in the try/catch
, not the entire block. Otherwise we're back to the problem of wrapping too much code and potentially swallowing errors.
Something like:
let ops
try {
ops = await Promise.all([
getGeoLocation({ mode: geolocationMode, offline, state }),
server,
])
} catch (err) {
error(err, { exit: false })
hasServerError = true
return
}
const [geoLocation, { registry }] = ops
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.
Aaah I see, done.
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.
It's looking great! Left just a couple more questions.
@eduardoboucas this one is now updated with edge-bundler changes and is now ready. |
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.
lgtm
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.
Great work!
the backstory is that Netlify CLI has trouble installing deno on my 64-bit ARM Linux VM (aarch64), see details on netlify/cli#4685 via netlify/cli#4621 unfortunately this didn't really fix the problem for me (should have been part of the 10.6.2 netlify-cli release netlify/cli#4729) but seems to be what other devs are using locally anyway so it seemed reasonable to bump it here the new @types/node dev dep is to avoid a (new?) unmet peer dependency warning with the new cli package
🎉 Thanks for submitting a pull request! 🎉
Summary
Fixes #4621
Requires netlify/edge-bundler#42
netlify dev
breaks in case one runs it on a platform (e.g linux aarch64) not yet officially supported by deno, to avoid this we need to gracefully fail Edge Functions making it possible to continue usingnetlify dev
.To test this:
fix/add-error-state-to-after-download
branch of edge-bundler; runnpm install
andnpm run build
in edge-bundler to set it up; edit CLI's package.json to use the cloned version of edge-bundler eg"@netlify/edge-bundler": "file:../edge-bundler"
if (downloadedVersion !== undefined) {
to cause the binary download step to throw an error.await this.writeVersionFile(downloadedVersion || '')
to get past TypeScript type check errorsnpm run build
to make changes available CLI~/netlify/cli/bin/run dev
Error string for review:
› There was a problem setting up the Edge Functions environment and it's unfortunately not possible to run Edge Functions from the CLI on this platform. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: <error.message from error object>
Screenshot:
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)