14 ms·
Vercel Edge Middleware: Dynamic at the speed of static
- epberry 4y agoThat's a nice use-case with HashiCorp and complying with country-specific regulations.
- beatboxrevival 4y agoExcited to finally use this!
- brycewray 4y agoStill waiting for the long-promised *non*-Next.js examples, though: https://github.com/vercel/examples/tree/main/edge-functions https://github.com/vercel/examples/tree/main/edge-functions :-/
- leerob 4y agoHere's an example with SvelteKit[1]. You can put a middleware.ts (or.js) in the root folder of any framework and it will work. We also have examples for using Edge API Routes, which work with any framework[2]. [1]: https://github.com/vercel/examples/pull/320 https://github.com/vercel/examples/pull/320 [2]: https://github.com/vercel/examples/tree/main/edge-api-routes https://github.com/vercel/examples/tree/main/edge-api-routes
- okbel 4y agoHi!!! `vercel/examples` maintainer here. We have some with Svelte and plain edge examples, but more importantly, what would you like to see?
- brycewray 4y agookbel, thanks for the reply. I am interested in translating a Cloudflare Worker (and I know that's the tech underneath Vercel Edge Functions, as leerob indicated last year) that, on my site on Cloudflare Pages, manipulates headers for assets-caching and a Content Security Policy. This is framework-agnostic — I've used it with Hugo, Eleventy, and Astro. Thus, any headers-related examples which *don't* start with `import { NextResponse } from 'next/server'` would be very helpful. :-D Again, thanks, and congratulations on today's launch to GA.
- guibibeau 4y agoWould an example with a custom CSP be useful ?
- brycewray 4y agoguibibeau, that would help, too (although I presume it still would come under the subject of HTTP headers). In short: *any* examples that *don't* require any part of Next.js --- or any other specific framework --- would be what a number of us have wanted since last fall's announcement. Thanks!
- pirate787 4y agoI don't get it. We run a production headless workload on Vercel and it is slower, has fewer features, yet is more complex and expensive than traditional LAMP server stacks.
- leerob 4y agoHey there, sorry about this experience. Would love to help investigate – want to send me an email (lee at vercel dot com)?
- diordiderot 4y agoYour hustle is bonkers Lee. Content, engagement, etc. Much respect
- alex_suzuki 4y agoIt’s called progress.
- rglover 4y agoI chuckled. 10/10.
- Mo3 4y ago.. a traditional LAMP stack is not in any way comparable to what Vercel (and other similar services) offer. We don't use Vercel either for it is slower and offers less functionality than competitors but comparing the general concept to a LAMP stack is definitely not valid.
- beatboxrevival 4y agoCurious what you use instead and what features you use that Vercel doesn’t have.
- Mo3 4y agoAWS Amplify and Firebase However I have to admit that we don't necessarily run the "target" applications that Vercel was really designed for. We have a full suite of Lambda backend services that communicate with each other in VPCs and over SQS. We have scheduled executions using CloudFront and listen to events happening in several other AWS subservices. Now, we also have two "simpler" React applications that we have actually test-driven on Vercel before, but the cold start time of functions was honestly quite horrible and detrimental in comparison, and the problem that really drove us away very quickly was the lack of integrated database and authentication solutions (e.g. AWS Amplify/DynamoDB/Cognito and Firebase/Firestore/Auth). I know about Railway and 0auth, but we have no interest in using several different providers with uncertain confidence in them just for basic application logic, especially because they don't integrate back into Vercel at all (like e.g. functions being called when a DB record changes) and seem to be more expensive than even AWS itself. If Vercel was more like a "Heroku for serverless", and at the very least offered some of these basic features directly, and then had some good ways of connecting them together, we would potentially reconsider.
- admn2 4y agoWould be really appreciated if they would enable their free plan to be used for "commercial" sites. Their definition of a commercial-purpose site is so expansive it precludes just about every site I need to stand up. I know they deserve to make money, but Cloudflare, Netlifly, Heroku, etc. all offer this, so makes it hard to justify not just using one of them.
- gigatexal 4y agoCan someone explain this for a non-JavaScript node dev?
- likortera 4y agoYou push your code and only god knows where it runs but cheaper and more webscale.
- likortera 4y agoAnd I'm not sure about the cheaper.
- jpomykala 4y agoIt’s a bit more expensive but only god knows where it runs*
- jenius 4y agoVercel is fairly clear about where it runs your code - depending on the type of page/deployment its going to be either S3, Lambda, or a cloudflare edge worker. There is a ton of logic behind how deployments work but the general benefit of using a service like Vercel is basically exactly as described above -- you push your code and it just works and you don't worry about it. This is an attractive prospect for a lot of folks who want to spend their time making their apps better and not building/monitoring infrastructure. However, there are some folks who really like to build and maintain their own infra and in that case a service like Vercel might not be the best fit.
- bbqbbqbbq 4y ago
- ElijahLynn 4y agoVercel is all proprietary/closedsource right, just Next.js is opensource right? Truly asking/wondering, not making a statement or trying to attack, just getting clarity? I ask because I work on VA.gov which requires FedRamped SaaS and PaaS OR on-premise installs and I don't think Vercel has either but we could use some parts of Vercel as on-prem if there were a paid on-prem support system. VA.gov right now is a static build system (Metalsmith + Liquid templates) stored in an S3 bucket that we are working on moving to Next.js. Here are the open source repos that make up VA.gov: https://github.com/department-of-veterans-affairs/content-build/ https://github.com/department-of-veterans-affairs/content-bu... https://github.com/department-of-veterans-affairs/vets-website https://github.com/department-of-veterans-affairs/vets-websi... https://github.com/department-of-veterans-affairs/va.gov-cms https://github.com/department-of-veterans-affairs/va.gov-cms
- CharlesW 4y ago> Vercel is all proprietary/closedsource right, just Next.js is opensource right? Truly asking/wondering, not making a statement or trying to attack, just getting clarity? Based on vercel.com/oss, it appears that most bits of the Vercel PaaS are closed source, and I don't see an on-premises hosting option. Vercel also doesn't appear in FedRAMP Marketplace search.
- ascorbic 4y agoYes, the open source Next.js doesn't include support for deploying middleware to the edge. If you run `next start` it runs middleware in the main server process. I work at Netlify and to support running Next middleware on edge functions we had to write our own open source integration for it, just as we did for deploying Next to lambda functions.
- lagrange77 4y agoAs someone who has never used serverless functions before.. Netlify functions are based on AWS lambda functions, which spin up a container with say a node.js runtime environment everytime a request (or another event) comes in, then executes the user provided node.js function within the runtime. I can imagine that handy for something like cronjobs or api requests which happen occasionally. But using Netlify functions for things like Next.js SSR (or API routes) means, that for every single website request, a new container is setup, the function is run once, and the container is discarded. Am i right in this? Isn't that a huge overhead in contrast to a long running server process?
- johnnypangs 4y agoI like Vercel but if you have more than 10 devs on your team you have to be upgraded to enterprise which when my company asked for a quote we received an increase for 15 devs from what pro would have been. It was from $300 to $3000 a month! We just wanted to use vercel for hosting and previews but after the quote we ended up going with aws amplify.
- pbreit 4y agoHow do I use a database with a Vercel app?
- steventey 4y agoHey! you can check out some of the database integrations that we have here: https://vercel.com/integrations#databases https://vercel.com/integrations#databases