about 4 years ago Syntax Podcast
Supper Club × Edge Functions and Deno with Eduardo Bouças of Netlify
- 00:02:33 Introducing Eduardo Bocas from Netlify
- 00:04:24 Serverless functions allow adding functionality without servers
- 00:07:19 Edge functions run closer to users for lower latency
- 00:13:05 Edge functions can modify requests and responses
- 00:20:21 WPSMTP sponsor ad
- 00:22:44 Deno overview
- 00:25:38 Differences in Node and Deno package ecosystem
- 00:33:05 Postlight podcast sponsor ad
- 00:38:13 Languages used to build Netlify Edge
- 00:43:20 Importance of open standards
- 00:47:16 Using Warp terminal
- 00:51:24 Closing thoughts on being kind
- 00:52:23 Podcast pick - S-Town
Edge functions can modify requests and responses
Guest 3
Chain But yeah. You can build your own, like, authorization layer as an edge function, then you can distribute with with your team and they can just add it to their to their flow and it'll kinda
Guest 3
do things that actually modify And if you if the validation, Injecting
Guest 3
programming things on my machine. I just use the default. The only thing I use a MacBook Pro.
Wes Bos
Another,
Guest 3
One function And I think there may I think that bias you're able to make a function Absolutely.
Guest 3
you want to Launched this, because it does allow you to run logic
Guest 3
Some parts of those, of that HTML page based on where your users are. So you wanna check that if my, So maybe I can Oh,
Guest 3
possibilities for people to to build functionality with their functions.
Guest 3
messing with the cookies that are part of the request or completely changing, like, the caching headers. And so import packages directly from modify So Deno is Yeah. I'm I'm waiting it out.
Guest 3
data you choose to return from your function.
Wes Bos
a response. Awesome. That that makes a lot of sense is that you can just jump in at any point. And, like, that would also So what it does is you configure it to use Postmark,
Guest 3
to add dynamic go into your repo and add a JavaScript file that has the same kinda shape as
Wes Bos
And if you wanna be able to protect those images, sour you on something. So, yeah, I think users will appreciate that very much so. Yeah. Because I we talked about this on our very first edge when I was like, it's it's kinda weird that there's so many providers of these edge things, but they all kinda implement their own
Guest 3
the response put those files alongside the rest of your site and they're Deployed and versioned alongside the rest of your site. So if you have, like,
Wes Bos
coolshirt.comforward/stevo with this newfound
Guest 3
and also
Wes Bos
and pass it along to the next guy. Right? So that would be kind of a cool use case with with specifically with images. I like that a lot. And you can also,
Guest 3
the response at as it comes back out.
Wes Bos
To do those, like, forward slash. But now I'm thinking, like, oh, no. You don't have to have that, like, referral URL logic as part of your app. You could throw that in an edge function,
Wes Bos
Set a cookie of whatever referral and then continue on your way. You don't have to bother the product team with integrating this top level
Guest 3
HTML is definitely, go to netlify.com, And and and yeah. And that allows us to to create, being built with An edge computing model in mind, lower level Closer to the serverless paradigm and now closer to the serverless paradigm on the edge, which I think is really interesting.
Guest 3
back to the client.
Guest 3
Tap into this Yeah. And so that that layer that kinda bridges the gap between
Guest 3
your CDN,
Guest 3
From the request, and it will run some logic that validates that header. Does this header contain like a valid JWT the response serverless functions as
Guest 3
set of capabilities was not guaranteed and
Guest 3
And that's that's, that's quite a powerful thing. And and and the the use case that I just mentioned is definitely, an example of that. That's a that's a great one. Let's talk about one of Sponsors, WP the benefits performance If if edge functions aren't enough. Yeah. I don't want my question to sound
Guest 3
you don't, like you're you're suddenly able to kinda uses,
Guest 3
So for example, you could have where that takes
Guest 3
pattern where
Guest 3
running for a given path. So you can built for this scenario where you have
Guest 3
as it comes back out. So you could have, Let's say that you have a page that renders some some We have Hundreds of thousands of connections being created and destroyed over and over again.
Guest 3
it it's almost like with great power comes great responsibility, like, you you have, You know, you you have access to effectively treat these as, like, composable Distinction, you think that the experience is something that is not true for I think I think there's a risk if you're in web development. There's a risk of of feeling that every little thing that comes out or every little that someone talks about, you need to know what that is, what that does, how that works, and and I think that can create, like, an unhealthy amount of Yeah. And I'm super excited to talk to you about it. Awesome. I'm a big fan of, And I think we've been pulling in, You have a set of as it as it comes in.
Guest 3
the platform I think, at this point, which is, I kinda lost the lost the habit of, like,
Guest 3
in Portugal. You're gonna replace this image tag and instead of rendering a burger, you'll render like an image of a hot facial, whatever, because we do love that part too.
Wes Bos
you really have to build your own server
Wes Bos
use case that I thought about recently is now that I have edge functions in my head, I've been sort of, like, going through life To intercept all those requests and then you have to proxy all that data through. So with an edge function, you could just throw it
Guest 3
really important, I think, is and your database is sitting somewhere in a a centralized
Wes Bos
I was thinking about that a couple years ago, That you've got, like, images.
Wes Bos
in the middle. In the middle. I love middleware and I think people listening will really understand that because there's a lot of express
Guest 3
modify in maybe we will see something like that. Do you foresee a future caching in place To make sure that you, you know, don't
Guest 3
before it is delivered doesn't succeed, then you can just do a rewrite or redirect to a page for, like, for example, your login page. So this is an example of a of a use case of you, like, intercepting a request,
Guest 3
visitor is
Wes Bos
like like, I don't know,
Guest 3
And the response will be terminated with whatever, Kinda pans out. Yeah. Totally. Beautiful. Great answer.
Wes Bos
go to, I do all of my,
Wes Bos
Mail SMTP. This is a WordPress the Netlify serverless functions. I use them on my my own website for all kinds of stuff. I have,
Guest 3
on a specific path like / hello, and that's the only route where the function will execute, or you can use like a wild card thing Building blocks, and you can from an edge function, you can decide to
Wes Bos
And I was like, they you would have to have full buy in from the application
Guest 3
So, fast. But at the same time, I keep kinda hearing people having problems with, like, compatibilities ciggy?
Wes Bos
or something like that. And they have these referral links. And I was like, man, like, Top level
Guest 3
whatever one of them being know what Deno is or you don't You're not even familiar with what a runtime is and if these are, like, confusing terms to you. Maybe we can serverless function, we're talking about a And that can still be the case with, it's
Edge functions run closer to users for lower latency
Scott Tolinski
Yeah. So what you're saying is, basically, it matters less
Wes Bos
How cheap your mobile phones are. I guess Europe is is pretty cheap as well, but, Thank you. Wpmailsmtp
Scott Tolinski
try Hessara. And, again, only the first 100 people who Use this coupon code can get this deal, so go there right now and sign up. Thank you.
Wes Bos
is hosted Special sauce. And then, like, a week after we said that, enjoy
Guest 3
website has certain kinda a new, like, open, Totally possible to, like, build a package that where you just, you know, write the file and it'll take care of Spinning up an instance that will be there to serve the traffic, and it'll take care of kinda spinning it down when it's not needed anymore, which is also interesting from Like a cost perspective.
Scott Tolinski
Authorization
Scott Tolinski
Use the coupon code,
Guest 3
And,
Wes Bos
or a central serverless
Guest 3
I think the main Mhmm.
Wes Bos
or or
Scott Tolinski
and subscriptions
Scott Tolinski
of the like, how how the the the technology behind how it gets run and more of the fact You you have access to the server wherever it gets run, whether it is at the edge or yeah. Yeah. Definitely. This episode is sponsored today by Hasura.
Scott Tolinski
using the link in the show notes,
Scott Tolinski
API
Guest 3
is where in the world the code is running. Where where are those servers that are that are kinda running that that logic? Because when we're talking about a serverless function, we we usually talk about, like, a regional function, like a piece of code that sits somewhere in, faster and more kinda engaging experiences, it's not
Wes Bos
in Virginia
Guest 3
People, you know, in in other locations. And I I definitely think that Edge Functions can help with that. I don't think unnecessarily need to pull the same version of the same package over and over again, a lot about that. And so,
Wes Bos
You have no idea how good it is for you to have those things. And the same thing is with the Internet as well as you don't realize
Wes Bos
I think an important thing to note here is,
Wes Bos
where where in the world are you based, Edward? Are you in the States? So I'm I'm in Portugal. I think this I'm in Canada, so I'm allowed to say this. A lot Times Americans think
Wes Bos
It it's so funny. Me and my wife were talking about the other day because someone's like, just go to Target or one day Amazon or same day Amazon. And we're like, the rest of the world does not Have those things.
Wes Bos
And a large portion of the Internet
Scott Tolinski
Closer to where your users are. I don't know what you guys are talking about. Everything's really fast for me. It's super Yeah. It's funny. I I've I've been seeing this planet scale around for a while now, just their logo popping up, and I've never really gotten the
Wes Bos
fast. Yeah.
Wes Bos
you got it good. Yeah. So let's talk about the use cases as well. Like, why what In what situation what are some examples you wanna use an edge function over,
Scott Tolinski
In just about no time whatsoever, you can get started today for free in 30 seconds. Or if you wanna try out the Standard tier at 0 cost, you can use the code at tryhesura
Wes Bos
Why would you need that until you go to somewhere else in the world? And for Canada, it's pretty much the same. It's pretty fast here. But If you go to other places in the world, can you actually feel that a website is sluggish? Yeah. I've I've, yeah, I've had that experience.
Scott Tolinski
dotinfo.
Guest 3
To have in your, piece of logic that will always if you want, these primitives that that you can use. And Dino is a
Wes Bos
in the US. And a lot of Americans don't understand
Wes Bos
their experience is the same for the rest of the world.
Scott Tolinski
Now Hasura is a service that makes it really easy to have a fully managed production ready GraphQL
Scott Tolinski
just, like, baked right in. Not only that, but there's a lot of tools for data relations, especially data relations across API so you can have multiple services
Guest 3
Serverless functions There are a bunch And then there's the aspect of
Guest 3
the the invocation model of these functions.
Guest 3
in,
Scott Tolinski
And there's a lot of cool stuff there and documentation and all these types of things to get you ready. But at The basics of this, Hasura is an awesome way to have a GraphQL API with just about no effort, giving you all sorts of things like or you can just do hasura.infoforward/free Talking about this in the last episode, it's shocking how many people just use either the default theme or it's like they don't. It's like just the dark theme or just the light theme or the GitHub theme.
Guest 3
duplicating that code to Potentially dozens of locations around the world. And so when your visitors make a request to your function,
Scott Tolinski
trial if you just wanna type it out.
Postlight podcast sponsor ad
Guest 3
existing in this new serverless a
Guest 3
more It's from the same, they will be routed to, an edge function. At least from like, now we're talking more specifically about Netlify Edge functions. And I think this is true for most providers, but I'm gonna talk specifically
Guest 3
they recently launched this,
Guest 3
innovating into space and in creating, like, wipe it from my memory so that I can listen to it again. It's a it's a podcast called S Town.
Guest 3
if your function needs to Talk to a database, for your database. Yeah. So for example, with with PlanetScale, Yeah. You can definitely you can definitely notice that.
Scott Tolinski
the why. But I think this makes it a little bit
Guest 3
are sort of in a different world, but we are seeing more and more innovation that bring them and those and that function
Guest 3
is that a good trade off that we want? creating to the output of any command, and you can share that with someone from your team. I think that's really cool. The only problem that I've hit with it is and that's that's kinda the most exciting thing for me about about that is kinda building things in the open and not Forcing people to be, like, locked in to a specific provider. And I think that's so huge when you get into these types of things and then all of a sudden you hit Someone's proprietary format or something, and it just can really that this function will run for. So you can say that it runs on the location that is closest to them, and that will deliver a much faster response with a with much lower latency.
Guest 3
we're seeing a lot of companies They will magically solve it for every single use case, and maybe we can talk a little bit about that. But I think it's it's a great tool a lot about this one because I didn't want to say anything about web development because I think we've we've, you know, talked.
Guest 3
This option Still provision themselves. They still kinda make the server
Guest 3
of having your code running in dozens of servers around the world becomes Questionable because you will still need to go back to the centralized location to talk to your database.
Guest 3
then
Scott Tolinski
Is that something that you think is is an important thing, or is that just Head on over to syntax.fm on the surface.
Guest 3
Manage all the complexity of, of like connection pools and and things like that. So that's that's the first
Scott Tolinski
And I I think for the most part, that's not like a huge huge problem, but that doesn't seem super in
Guest 3
database engines like MySQL and Postgres and things like that, Where they kinda give you, Terminate a request.
Guest 3
to traditional different
Guest 3
if you in in the space, a lot of stuff going on.
Guest 3
with a serverless function, you will So to speak, and kinda plug into node or plug into d node and plug into other run times. And so, I yeah. I I think that that makes a lot of sense, and I can see the, you know, the community kind of going in in that direction for sure. Like, you have, like, a save function. Yeah. And then this you could have, like, local storage adapter or node adapter, Deano adapter or key value store adapter or whatever.
Guest 3
an example of that is
Scott Tolinski
in a database needs to think about. Yeah. That's that's a great question. And
Guest 3
And I was I was kinda alluding earlier to the fact that maybe an edge function will not magically solve all of your use cases and in some situations you might not Want to use 1. And I think, database that l that give you, like, read only really imagine world?
Scott Tolinski
is that whenever you have a serverless function that's working with a database,
Guest 3
the database APIs like write disk or or or other I think, language, that will maybe read a header with with customers.
Guest 3
of companies And So you still have, like, your main region for your database where you do your rights, out something like this, you do your best to And innovating in the space where they can like, in in in databases, in the database world, a lot of these companies are,
Guest 3
story starts to become isolate
Guest 3
in in different regions around the world, and that creates We felt that, maybe
Scott Tolinski
You have to essentially open that connection and close that connection each time, right, or at least
Guest 3
And It's also really cool that it can Share like a live, JavaScript or TypeScript,
Scott Tolinski
Something that only bigger organizations seem to worry about. Is that something that your average developer working with a A serverless function
Scott Tolinski
infinitely scalable to do stuff like that.
Guest 3
A a typical exploring you can also
Scott Tolinski
So we have something called con connection pooling or database Mhmm. Pooling.
Guest 3
Suddenly, it you know,
Scott Tolinski
way more clear to essentially why this is an interesting or exciting option here.
Guest 3
an endpoint that you can hit and that will, under the hood, Totally shameless, so go nuts. Yeah. Feel free to, like, to check my my you need this other people need To, you know, to take into consideration if they're thinking about migrating something from node to to Deno.
Serverless functions allow adding functionality without servers
Wes Bos
which is something quite quite powerful as well. So we have serverless functions, and a lot of people are still getting up to speed with it. And then in the last couple of months, we've been talking and hearing a whole bunch about
Wes Bos
literally anything I want in a Node. Js environment inside of that function, which is pretty cool. Yeah. And it's reminiscent of just running
Guest 3
make make possible for you because you just
Wes Bos
and then, boom, that sucker is running on the server. And I can do
Wes Bos
Edge functions. So there's a there's a new one. Do you want to try to give us a rundown? Like, what what's the edge? What does that mean? People keep saying the edge.
Guest 3
deployment and versioning side of it, which, So
Scott Tolinski
You just have a script that would collect that post request and send an email. So in the server, it's fine. It's like now we can do all of that on JavaScript without having Worry about our own server without having to have it on a, just a general shared hosted plan or something like that. So it's, yeah, it's it's funny because it is it's another way that
Guest 3
And what are what's an edge function? So edge functions are still very much part of the serverless I will also, like, keep an eye on on social media and and see what and then you hit that URL,
Scott Tolinski
scripts from, you know, back in the day when we just needed to send an email.
Guest 3
kinda the our runtime And you kinda run all of that logic in the edge function. And if you if it does Kinda if you validate that it does have the right permissions, then you'll let the request go through and follow its normal opportunities for people to to I thought I'd mention a Podcast
Wes Bos
Especially with like frameworks like,
Wes Bos
I don't know if you would call it frame no. I guess Netlify is not really a framework. But you simply just create a At least in my Gatsby website, just make a file What we're against, right, is when you run a,
Guest 3
you know, if you wanna do, like, a rollback, then your Functions will kind of follow the same version, and and everything will will be in sync, can also hit a database that is also close to your users. And that's where I think, node behavior
Wes Bos
The rest of your front end side, and it just runs on the server and kinda does things for you. And that's, yeah, that's a pattern that I really like as as a user. Yeah. That that's actually a great way to put it as to, like, what is a serverless function? And it's kind of something that maybe we overlook is that we've talked about serverless functions on the thing, On this episode or sorry, on this podcast so much that maybe we should, like, define it really quickly. And that's exactly what it is. It's if you Are a front end dev or literally anyone and you need a little bit of server, you don't necessarily have to spin up a server.
Scott Tolinski
Everything that's old is new again, but in the same way, it's totally new. Yeah. I was just gonna say that I I usually kinda,
Wes Bos
like Netlify.
Deno overview
Wes Bos
you are running in like you said, you're running in a different
Guest 3
runtime that was actually created by the same person that Created Node, which is kind of interesting.
Guest 3
one of the big reasons that we specifically for the
Scott Tolinski
you know, speed in which the function executes is of paramount concern. So that that makes a ton of sense if Dino is seen as a more performant option. Yeah. Yeah. Definitely. So with Dino,
Guest 3
an important aspect here. If you're
Guest 3
is something that is top of mind, for for Dino.
Guest 3
Vocabulary actually give you I really like,
Guest 3
and performant that will automatically get assigned a URL like entirely in the open, and that is based entirely on open standards.
Guest 3
you can suddenly interact with a file system and you have these kinda node specific APIs that allow you to do that. And so Deno is just another one We felt that we weren't, like, really moving Any request
Wes Bos
Environment. And I I got tripped up on this the 1st time I tried Cloudflare Workers. I tried to npm install something, and it didn't work. And I said, like, what? What's going on here? Why is it? And then I realized, oh, like, this is not like, not every environment that runs JavaScript is
Guest 3
but you're running that code with a different set of
Guest 3
So the the the node ecosystem is unlisten, available to handle traffic and then take care of Kind of tearing it down when it's not it needed anymore.
Wes Bos
or Node. Js on the server, there there actually is lots of environments where JavaScript can can run-in.
Guest 3
Yeah. Yeah. And it it's built with pressing up to get you to used relatively easily, sometimes and I couldn't figure out exactly when this happens, but sometimes, like the, need, of our customers, like, a a good comparison would be if you're, You still have the same And then there's a second,
Guest 3
choose it and that it runtime version of that serverless model.
Wes Bos
in in in terms. Sorry. In trade for speed. Is that true? Like, what are the limitations of using
Guest 3
but you have a different Set of, like,
Wes Bos
A web worker
Wes Bos
You get a smaller you get a more of a limited environment, at least right now,
Wes Bos
Deno over a regular Node. Js function?
Guest 3
a lot more contributors.
Guest 3
primitives, I think I just used the default theme. I'm sorry to disappoint our, part of this, of like how do we have a database
Wes Bos
get something in return for something else. And I think with Dino, you Let's talk about Our sponsor, it's another podcast. Can you believe it? This is called the Postlight podcast. So Postlight they rolled out the, what's the name of the The winter
Wes Bos
And some of those have trade offs in that you
Scott Tolinski
But, yeah, that that was longer than 2 seconds. I'm sorry. No. No. That's that's a okay. Yeah. Yeah. I think I think in general, you know, we The,
Wes Bos
the browser,
Using Warp terminal
Guest 3
Working on a new technology,
Guest 3
but I'm glad but I'm really excited about what happens on the edge. Even beyond, like, Netlify its functions, like, we
Guest 3
anticipate
Guest 3
to space,
Guest 3
pressure you you write a file either in JavaScript or TypeScript.
Wes Bos
absolutely everything because like like we've seen here today, you could probably figure it out. You released one of the very first platforms
Guest 3
that will If your difference that is important to note between, the traditional databases
Wes Bos
All right. Is there anything else that we didn't touch upon,
Guest 3
Investigate the things more than across those those run times. And
Wes Bos
is just Being fine with
Wes Bos
in the future of web development.
Wes Bos
Yeah. Yeah. That's great. All right. Last question I have here is, is there anything that you're really Excited about,
Wes Bos
today that you you would hope hope to touch upon or impart wisdom on our listeners? Yeah. I
Guest 3
then I will probably try to ask some questions and investigate, like, what this thing is about.
Wes Bos
using Deno in production. He figured it out.
Guest 3
as you you know, when you're rolling have a distributed
Guest 3
stuff, And so to answer your question, I think another to their pages that you wouldn't normally do with the serverless function because the serverless function usually just terminates, let me just talk a little bit about customers to run stuff, that it can serve a request in this, like, serverless compute on these different run times, but with an edge function, but And and the the kind of the surface
Wes Bos
we know better,
Guest 3
that I come across in my job. So if if if someone on my team or in other teams is kinda
Guest 3
What people will build, how people will use this feature that you're working really hard on, moves you between blocks In the output, I haven't figured out what what's going on, but that's that's not a Oh, I see. Problem that I face. Yeah. They they recently just rolled out the ability to keep your old prompt, exists. Like, if you if you're based in the US, you think that your
Wes Bos
not knowing
Guest 3
just just be kind to each other.
Scott Tolinski
but now they're I think they've relented and allowed you to use your own prompt, which is kinda cool. How do you stay up to date on web stuff? I mean, seeing as you're using Deno. Right? Deno is pretty high-tech. How do you Stay up to date here. Wow. That's a really difficult question.
Guest 3
I try to
Guest 3
Change the way that people interact with databases and and and to what extent
Wes Bos
being like, no. Like,
Guest 3
yeah, I edge functions also allow you to run-in this like in this Middleware, Context object that you can choose to add to your function or not.
Wes Bos
oh, my, is that a sage prompt? Yeah. If you like your old prompt, you can keep it. Yeah. Now you can keep it. They they tried to strong-arm you into using theirs,
Wes Bos
corner myself into learning new things all the time because, Yeah. I I can't do that anymore. Hey. Yeah. Yeah. I hear you on that. Yeah. Hey, I'm just getting old. Yeah. No. I think that's part I feel like that's part of becoming a, like, a senior or, like, a a more well rounded developer
WPSMTP sponsor ad
Wes Bos
off Or you can start with the free version
Scott Tolinski
especially for these types of things or maybe even not especially for these types of things. But,
Guest 3
you know, if you if you're a JavaScript developer and you don't
Wes Bos
Providers out there, they they have a whole list of them here, Sendlayer, SMTP.
Wes Bos
And they will send all of your mail with WPSMTP,
Guest 3
writing JavaScript so so yeah. So if you try to use a traditional database ever having to worry about Provisioning a server and kinda handling on yourself and and I don't, you know, I I don't like that. And so, you know, in your arsenal as a as a as a web developer, At Netlify, when when we compare them to the traditional application
Guest 3
a JavaScript, heavily relies on packages that were built by the community, And so it it it allows you to, like, dynamically modify That takes care of, like, Estown just talks about this kinda
Wes Bos
Email engagement tracking, visual email reports, weekly email summaries, integration with popular
Wes Bos
My favorite is Postmark.
Wes Bos
email,
Guest 3
in the browser.
Wes Bos
plug in
Scott Tolinski
Deno, and have that data relation happening without having to worry about the dreaded n plus one issue where You're after code in some special data loaders and stuff. None of that. You don't have to worry about any of that. No more no more data loader worries with with Hesara because that's something that I don't I don't know why I need to worry about that, but I gotta worry about data loaders now that I have a GraphQL server. No thanks. So Hasura can take care of all of that and more. So check it out at hasura
Wes Bos
providers like Sendlayer, Gmail, Outlook, and more. It helps Wherever people are and run them. Like, why do we need to run this in Deno and have this different environment where we now now we need to think about, Okay. Well, this is running in an Edge function, so I can't do any of my node stuff that's specific to node in there. And I got to make sure that my packages also work And Dino as well. Like, what's the benefit there? So I I think there's a lot of A strategy design and engineering firm. They work with some of the world's biggest organization to build platforms to scale to hundreds of millions of users, and they have a podcast with their founders,
Wes Bos
you avoid the spam filter,
Scott Tolinski
For sponsoring. Okay. So,
Wes Bos
On top of that, they add a whole bunch of,
Wes Bos
at wpmailsmtp.comforward/syntax.
Scott Tolinski
Dino, maybe maybe give it a a quick two second what is Dino, and then maybe why why might You choose Deno for this type of application.
Scott Tolinski
why why use Deno over node
Wes Bos
and your emails will land in the inbox every single time. You really shouldn't be sending, Peace.
Wes Bos
with WordPress. So what it does is they reconfigure the wp underscore mail function to use any of the SMTP
Guest 3
runtime.
Wes Bos
Just the regular PHP mail function anymore. Those are not ever gonna end up in the right place that they need to. So check it out. You get 50%
Wes Bos
features like email logs. What emails were sent? Who knows? Well, now you can.
Guest 3
So, for your database.
Wes Bos
that will fix all of your delivery issues with,
Transcript
Wes Bos
I am on the edge of my seat Oh. For this podcast.
Scott Tolinski
That's good. This episode is sponsored by 3 amazing companies today, which is Hasura,
Scott Tolinski
To fix WordPress email deliveries and assure your emails reach their inbox.
Wes Bos
So
Announcer
This
Announcer
Oh, I'm starving.
Scott Tolinski
And it's gonna be really exciting because I know Wes and I have a lot of questions about this kind of stuff.
Scott Tolinski
and let's talk
Wes Bos
why I would you want an edge function over a serverless function, and what about databases? And and and we'll we'll kinda go from there. So, Eduardo, do you wanna give us a quick rundown of, like, who you are, what you do for a job, and and and whatnot?
Wes Bos
API up and running. The Postlight podcast, which is a must listen for tech leaders about Solving tech problems via whatever service that you've you've configure it with.
Scott Tolinski
Welcome to the Syntax supper club. In this episode, we're gonna be talking with Eduardo Bocas. We're gonna be talking about Edge Functions and Deno.
Announcer
is the Syntax supper club.
Scott Tolinski
Edge functions.
Scott Tolinski
or denno.
Scott Tolinski
perfect place to get a GraphQL
Wes Bos
I I think this episode is there's a couple of things I want to touch upon it, and then we'll we'll see. So I want to understand, like Like, what is an edge function? We had an episode on it already, but, like, we're just 2 guys. Now we have an expert on, either a central server,
Scott Tolinski
So my name is Scott Tolinski. I'm a developer from Denver, Colorado. And with me today, as always, is Wes Bos.
Scott Tolinski
Wes, do you have what what's your what's your plan here for attack in terms of edge functions?
Announcer
Wash those hands, pull up a chair, and secure that feed bag, because it's time to listen to Scott Tolinski and Wes Bos attempt to use human language to converse with and pick the brains of other developers. I thought there was gonna be food,
Announcer
I sure hope you're hungry.
Scott Tolinski
which is the easiest way
Scott Tolinski
and and WPSMTP,
Scott Tolinski
I do know what you're going to say. It works better when you call that denno
Wes Bos
Netlify's edge functions Are implemented in Dino. So that's kind of interesting to me. And then we have a whole bunch of questions about, like,
Scott Tolinski
about I love it. I appreciate that. Yeah. So do you have did you come with any,
Scott Tolinski
So with us today also is Eduardo Bocas from Netlify,
Announcer
so buckle up and grab that old handle because this ride is going to get wild.
Wes Bos
specifically,
Importance of open standards
Wes Bos
less
Scott Tolinski
text Editor theme and font.
Guest 3
Customizing
Scott Tolinski
our listeners.
Guest 3
I use Versus Code.
Scott Tolinski
you know, I don't know, customized tools. Yet had Anyone use Vim yet? And we only VIM. VIM. I only said Emacs. Yeah. Yeah.
Guest 3
that I've tried recently, which I'm still kinda Trying out and I've been really enjoying so far is Warp, this new, like, Hermes.
Wes Bos
which is, like, one huge thing for me because I was just comfortable with my existing, referrals.
Wes Bos
Proprietary that node because Deno is even closer to,
Guest 3
I really like the fact that you can,
Guest 3
like the auto completion thing works really well for me.
Scott Tolinski
And then for
Wes Bos
like web standards than than Node. Js is. And now Node. Js is like, oh, maybe we should implement some of these standards
Scott Tolinski
their computer, it's, like, always just a Mac. For phone, it's just an iPhone. For text editor, it's always just Versus Code. It's like you you hear tell of all of these super hackers using all of these,
Wes Bos
have you have you hit any issues with Warp? I tried it a couple months ago, and I've been using it last week as well and enjoying it. Have you what have you liked about WARP, or has you have you had any issues?
Guest 3
and stuff. And so, Yeah. We've talked a little bit about Warp. Yeah. That that one is really interesting, and I'm kinda excited to be trying something new and fancy. But other than that, I'm just really boring. What,
Guest 3
like a live URL to, whether
Guest 3
the latest, you're you're right in that
Guest 3
to the most recent command doesn't really work for me. And instead, it just Twitter and my website. So I'm at edwardobucasandedwardobucas.com.
Wes Bos
Yeah. Yeah. That one's just so it's that's that's a great like, honestly, like, if you write Dino, it's almost
Wes Bos
as well. Like, we just got fetch and they're looking at a lot more. Beautiful. Let's move into the next section here, which is our questions and answers. We have a couple questions that we ask everybody that comes on. We always find a few useful nuggets here or there. You can answer as long or Short as you want, for these. And the first one we have here is, which computer do you use?
Scott Tolinski
you know, really high-tech,
Languages used to build Netlify Edge
Guest 3
Request and response objects. And that's like the simplest,
Guest 3
runtime, intercept
Guest 3
layer, which is this kind of logic also written in Deno abandoning that and and kinda deprecating that in favor of edge functions was because
Wes Bos
What is a Netlify function and what is run kinda closer to the metal on Deno that is Yeah. Also run, that also written in in Deno. Excellent. Wow. That's cool. Yeah. Dino and prod. Yeah. Definitely. That's funny because Scott and I, like, 6 months ago, were, like, yeah, we still haven't really heard much Much about like like who's actually using Dino? And then just boom, in the last couple of months, like, everybody's coming out swinging, being like, no, like, this is legit. Like, a lot of people have been working on stuff. So it's really exciting to hear this. Yeah. Yeah. It felt quiet for a little while, but it seems like their the in inner community
Guest 3
languages that we use for different for different services.
Guest 3
our own, what they'd love to see, I have to dig into this. Yeah. I haven't fully explored everything that PlanetScale can give you. I was just exploring this the other day because as soon as I Saw something about, like, a multiregional you're writing a function that will based on Deno.
Wes Bos
edge functions at Deno. Like, we know the edge Functions
Guest 3
is specific to Netlify lives in this kinda read only endpoints so paradigm in the sense that they the space in the right direction because we were effectively you can ask you can also, like, and most recently, Edge Functions.
Guest 3
runtime that was specific to Netlify.
Wes Bos
at Netlify, users or connect users on this that listen to this podcast, and they all understand how middleware works. You You jump in, you grab the thing, you can change the request, you can redirect it, or you can simply just check for something
Guest 3
Built we were sort of building region, platforms like Netlify and others
Guest 3
The right direction, boring and and Seem like I'm just plugging
Guest 3
all the rest is just, You know, using web standards, and where that that you get
Guest 3
design principles that that that I think are kind of Worth touching on.
Guest 3
started experimenting with Deno, but
Wes Bos
but the logic all of the logic surrounding edge function. Did you write that in Dino as well or, like, what language do you use to write stuff at Netlify? I'm always curious about that. Yeah. So we have a,
Wes Bos
Nice. Cool. That's cool.
Guest 3
for for the community so that you're not writing an edge function exploratory, And, about, like, the way that Dino
Guest 3
And Yeah. The reason that we ended up Building edge functions, so that it it'll run for multiple route. And to answer the question specifically of why not node, I think mostly is around And then you need to tell Yeah.
Guest 3
on the edge quickly enough step that is even A while ago, I've had to make peace with the fact that there's a bunch of Hot new things that I'll just won't know about. I will I will not be able to be across everything, and and that's okay.
Guest 3
It was under, like, a, a private beta
Guest 3
all of your functions and then, And another, And and almost treated like a text editor so you can, you know, really select the command and change things in the command.
Guest 3
even though we were solving the specific more than just 1 specific technology or one specific product, I'm really interested in seeing kind of what happens What what people build with this. Because So to go back a little bit, the way that you Create a nets function in the 1st place is you declare, it'll work.
Guest 3
this product called Edge Handlers.
Wes Bos
A question about, like, actually implementing
Guest 3
program,
Wes Bos
run-in Dino,
Guest 3
we can talk a little bit about that because it it has some, like, there's a lot of movement into space,
Guest 3
And and that we feel is
Guest 3
And it was solving this exact problem. We wanted to allow
Guest 3
What we call the the bootstrap
Guest 3
A request and return and returns a response. And when I'm talking about request and response, I'm talking about the web standard
Guest 3
this way and and and kind of partnering with with Deno on this is because we see Deno as,
Guest 3
API.
Guest 3
that is available to you, some people that that are kinda that I follow are are talking about. But I tried to Yeah. Take it easy and and kinda not not kinda But, yeah, that's that's what I'm running on at the moment. For me too. Yeah. Yeah. What about, And that was a big part of, course. You just say, let this go through.
Guest 3
when you write a Netlify Edge function,
Guest 3
process and in the way that we decided to build edge functions all the way to the runtime that it makes more sense to run Deno at the edge Then then node because kinda
Podcast pick - S-Town
Wes Bos
Yeah. Wow.
Guest 3
twists and turns, and it's just a fascinating, and kinda patching security things. And so You just especially as a as a front end developer, you can just A paradigm shift that, that some people might be surprised by when they're kinda switching from node to dino.
Wes Bos
Yeah.
Scott Tolinski
podcast that I would definitely recommend. I will give this a listen to. I you know what? I've seen s tone pop up a whole ton of times, and it's one of those ones that I've never listened to. So,
Wes Bos
Alright. Last section is any shameless plugs, Outlook on life. But, like, I've been listening to a lot of podcasts, and they always say
Guest 3
yeah, if something doesn't work,
Wes Bos
like, an expert on That can can really explain it to us and whatnot. And it's it's really cool to see both that as well as listen to all the Dino stuff. So thanks so much. I really appreciate it. Thanks so much for having me. Alright. Peace.
Scott Tolinski
for a full archive of all of our shows. And don't forget to subscribe in your podcast player We haven't really talked too much about, like, the length of time in which a a function needs to execute in. But when you're dealing in these Functions,
Guest 3
And, most kinda spec compliant different like, doing amazing things in innovating, and I'm really excited to see kinda for for the web,
Guest 3
yeah, if you wanna give Edge Functions a try, just,
Wes Bos
Man, I remember when cereal came out and it was just, like, That was so big for podcasts. Change the game. Yeah. Yeah. Definitely. Yeah.
Guest 3
and it is regions
Guest 3
My DMs are open, so I'm always Happy to chat with people about
Guest 3
in the developer tooling space.
Scott Tolinski
or drop a review if you like this show.
Guest 3
We had the opportunity to talk find Edge Functions in the product list, When we're talking about a So, you know, just Be kind with the people that you work with, with the people that you interact with on social media, and and yeah. That's I know that sounds like a cliche, but that's that's the only thing that I can that I can think of to to to ask people just, you know, be kind. Beautiful.
Guest 3
and
Wes Bos
Twitter or URLs or anything you wanna plug.
Guest 3
probably my favorite another, like, walled garden, another, like, proprietary, Still the Intel version, I've been dying to try the new almighty m one because I keep hearing that it's really And you can also token with the right permissions to access this route.
Guest 3
fascinating performance, for example, if we're talking about the AWS world, let's sit somewhere in US east one and and that's where your code lives and and that's where kind of your invocations will will need to hit.
Guest 3
producers as Serial which was, very very kinda, the the story is, like, full of I think that is already as it comes in,
Scott Tolinski
I just I clicked subscribe. I'm gonna have to listen to it. I think my brother was even telling me about it too, so I I have to get on that. Yeah. The gorgeous website. I'm just checking it out. Big fan of this. All that cereal money. They got that Yeah. Match up money.
Wes Bos
Awesome. Thank you so much for coming on. Awesome.
Wes Bos
We're like I don't know. We're we're sort of, like, new to this whole Edge functions things. We've had a couple of shows on it, and we really appreciate having,
Guest 3
Person, I'm a software engineer. I work at Netlify,
Introducing Eduardo Bocas from Netlify
Wes Bos
for,
Guest 3
serverless functions are a really powerful way for for people to kinda, To But then they give you, like, a set of context of, running stuff on the edge a while ago. So well over a year ago. And we actually
Wes Bos
like an Instagram feed. I scraped my Instagram. Since Instagram doesn't give you an API, it do some sort of shady stuff to get that feed, and It breaks every now and then, but that's I threw that in a serverless function.
Guest 3
So I work a lot with, I'm really interested to see what happens in the space. We've been talking about What happens, Because we run-in this middleware pattern, the request will then hit the the package that I've recently rediscovered, endpoint it would Normally hit if the Edge function wasn't running. So it'll hit, like, a static asset or an HTML page or maybe a serverless function that will run other things.
Wes Bos
what's it called? Like, OG image when you share a URL. I do all of that in Netlify serverless function, and it's it's awesome. It's been great because I have, like, a Gatsby website. But Anytime I need a little bit, a sip of JavaScript I like to call, I throw it in a function. It's been working really well for it for me.
Guest 3
Netlify functions, database. I'm like, I was I was all over it, and and that's definitely a a use case for it.
Guest 3
First of all, thank you for having me. It's a it's a pleasure to be here. Welcome.
Wes Bos
like thumbnail generation
Guest 3
add a lot of workflows and to, like, extend the functionality over the sites without So you add a file to your project startup times and just performance in general is,
Guest 3
and I, primitives that are Made available to you like the window object and kinda DOM manipulation things. And if you've ever,
Guest 3
currently, I'm part of the team at Netlify that works, in our, Definitely,
Differences in Node and Deno package ecosystem
Wes Bos
Gina Trapani, and Chris Lissacco.
Wes Bos
You can throw them in Adena or you can throw them in a Cloud for a function. Do you foresee that being like the next big thing where people say, okay, I'm going to write this really good Slug library. Or I'm gonna I'm gonna write this a really good data management or or whatever, but it'll it'll work anywhere. Do do you think that's gonna be more popular coming forward? I think so. I think if Deno if
Wes Bos
Yeah. Oh, I like that. I'm glad to ask you that because that's something I've been thinking about. I didn't think to I didn't think about the, like, sort of adapter approach.
Guest 3
like, more than I can kinda give you a solid,
Guest 3
a URL.
Guest 3
you know, from, API. So the the the interface
Guest 3
we're seeing it's you know, At the end of the day, the most exciting thing is seeing people doing things that they haven't even imagined having the ability to run things on the edge will change the way people build websites.
Wes Bos
where's that thing on impatience as a leader?
Guest 3
single digit or low Double digit millisecond of it it it's the same transition from node to Deno then from the browser to node, I guess. So it's it's still The same language, you still author just From, evolution, API that that we could think of. And anything that
Wes Bos
here. Just let's take a quick look at some of the The ones they've had recently. Efficiency is highly overrated. Some life advice.
Wes Bos
is an edge function, are those packages, like are they pulled downloaded ahead of time or or whatnot? Or are they done on the 1st run? Yeah. So they're pulled ahead of time, and there's,
Guest 3
contains, like, the core functionality
Guest 3
from a full URL that kinda serves your package, Yeah. And it just it just ensures that you're not Unnecessarily pulling stuff over the network. Okay. And and around the idea of, Code that can provision itself, and that can that is also like a I Yeah. You know, it's there's a lot there's a lot going on at the moment, and, a function that will work On Netlify, We talked earlier about how we have different kinda primitives regions
Guest 3
aspect worth mentioning just on the topic of kind of packages in in the community is that the reason that we ended up people feeling the pressure to learn everything and be on top of everything. And With everything that's going on in the world, that's even more tricky and even more unreasonable.
Guest 3
Unlike So, yeah, the offering.
Wes Bos
Vanity purchases on Elon Musk and Twitter.
Guest 3
you know, how do we spin up a node,
Wes Bos
why not just run Node. Js functions on the edge? Like, why not put a whole bunch of node servers
Guest 3
explanation do the same thing and achieve the same level of performance in node, But then again,
Guest 3
And
Guest 3
Deno.
Wes Bos
Kids and phones, parenting and technology, function running in North Virginia or or wherever the other AWS servers live. Mhmm.
Wes Bos
Really good. I very much,
Wes Bos
everything that Paul Ford and Gina Trapani put out. So I'm gonna be checking out this podcast myself. Sounds awesome. Check it out at post lite.comforward/podcast.
Guest 3
start to get More traction, then it makes sense that, you know, package authors try to create things that can be 3, with Deno, you community It's actually,
Guest 3
rust to to to kinda do some of these things,
Wes Bos
Yeah. You see a lot of people being like, like, what do you want from Dino? There was a threat on Twitter the other day, and a lot of people were saying a package manager.
Guest 3
handled by the Dino CLI.
Wes Bos
And they're kinda like, that's kinda
Guest 3
possible And you touched on something
Guest 3
tree and no kind of package dot JSON where you declare your dependencies and your versions and things like that. You just import
Guest 3
Operations, then it will not work because as we said earlier, we're we're operating with a different set of of primitives. So that's definitely something that, You know, I wouldn't I wouldn't necessarily call it a limitation, but definitely something that At some point, hit those problems.
Guest 3
Deno and other kind of JavaScript run times, Secure well known at the time. And, really interesting.
Guest 3
And I think into the weeds, Yeah. I think that I think that creates some interesting some interesting,
Guest 3
and then maybe different adapters that then do the last mile, When we're talking about Edge functions, we're talking about
Guest 3
as in
Wes Bos
Paul Ford, Rich Ziadi, Was not quiet. Right? It was like They were heads down working on stuff, I guess. Yeah. Yeah. Yeah. We we actually,
Wes Bos
They talk about tech, business, ethics, and culture. They've got hundreds of episodes, Middleware into it. So is that another, like, use case that you might see someone using? Definitely. I think that's a I think that's a great example.
Scott Tolinski
Yeah. What a collection of talent that is. Right? Yeah. Well so okay. So what about What about databases here? You know, one one thing that's always been kinda weird for me
Guest 3
A little bit challenging to kinda Path. So your function's like hello world and you'll get like a .netlify/function/helloworld,
Guest 3
that a node module will work In Deno, and in fact, if it uses any of the node
Guest 3
run times work in this open runtime that can potentially be used across different providers.
Guest 3
There's no, like, is you write a function that receives Build any in mind, which was, on the edge
Wes Bos
They work both in the browser
Guest 3
time. That goes a bit, About Netlify Edge functions here because there's a distinction traffic patterns ping me, and I'll make sure to fix it.
Guest 3
It's a lot more active. It's an older ecosystem as well. And so So is that, you know, Almost like serverless adapters our decision and coming up with use case that are, like, oh, I haven't thought of that, and that's really interesting thing. And so, yeah, I'm I'm I'm really looking forward to see how the whole edge space Podcast ever, and I wish that I could whatever they're building and kinda hear about, and I do a bunch of things around developer
Guest 3
today, that is built, And and I I wanted to to kinda mention this middleware pattern because I think it it Create some very interesting
Guest 3
kinda sibling tool called NPM, which then pulls packages from this registry, server side code in node.
Wes Bos
where people are writing packages that work anywhere? Like, do you think that's gonna be the new thing? Like, A couple years ago, people were big on, like, this is an immutable package. We're all writing things in this way. And and now I've actually found a couple packages that work.
Guest 3
Job just migrating that over to Deno because a really interesting pattern when you couple that with edge functions because you can you can have a function that is Kinda running really close to your users
Guest 3
is aligned with their vision of making something that is really performant, and I think it will be what are the routes, we
Wes Bos
and on the server, but also they work in a web worker, which means that you can throw them in,
Guest 3
it might not be a trivial early return, and so the next Function in the chain will will execute, and you can use this pattern to be like multiple edge functions.
Closing thoughts on being kind
Scott Tolinski
sick pics
Scott Tolinski
for us, things that you think are pretty cool? Yeah.
Guest 3
Had to think,
Guest 3
you know, and we we talked earlier about, like, we have different,