-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add support for 'deno' server functions #419
Conversation
🦋 Changeset detectedLatest commit: 5e5bb70 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Do we want to allow the deno runtime for the other functions ? (except from middleware as this one requires edge
)
Not sure if it's possible to make it work with the imageOptimization
function since it requires sharp
It should work with all of them (including I can test it out and probably make a follow-up PR adding |
Yeah that's fine, i'll merge this and a bunch of other PR tomorrow in 3.0.2 |
@littledivy I assume you did not test with the |
Ah yes that makes sense. It should actually be trivial to add generated dockerfile support for Deno too: FROM deno-lambda:latest
COPY ./.open-next/server-functions/default/. .
# Round down timestamps to seconds (workaround for https://github.com/denoland/deno/issues/23904)
RUN find node_modules -type f -exec touch -t $(date +%Y%m%d%H%M.00) {} \;
# Run index.ts to warmup the V8 code cache
RUN timeout 15s deno run -Ldebug -A index.ts \
&& timeout 15s deno run -Ldebug -A cache.mjs
CMD ["index.handler"] Preliminary startup time results show its on-par with the |
This patch adds support for running Open-next server functions with the Deno lambda runtime layer.
Discussed briefly with @conico974 on Discord, adding
runtime: "deno"
made most sense.Changes
cache.ts
when runtime is set to "deno"deno.json
and rename function entrypoint asindex.ts
(this will be redundant with Deno 2)Example
Here's how a deployment config would look like:
Next.js page: https://dvwb0nol21fnx.cloudfront.net
API route: https://dvwb0nol21fnx.cloudfront.net/api/hello