Gatsby Functions #30735
Replies: 6 comments 25 replies
-
Been running into an issue using Gatsby 3.4.0. I did not include the gatsby-plugin-functions in the project and there is no function in the project. This is what I was running into: |
Beta Was this translation helpful? Give feedback.
-
Hi I'm running into an issue with using a package in the function. Just the import of the package crashes gatsby-cli. Everything works fine when I comment out the import. I am using Gatsby 3.4.1, Gatsby CLI 3.4.1. CLI error:
Here is my function:
works fine if I comment out the first line where Full repo is here: Do I need to add some extra webpack config to use this package? Thanks, |
Beta Was this translation helpful? Give feedback.
-
I gave functions a quick try. I am basing most of my feedback on my long experience with Vercels offering, which I like very much. I'd very much like Gatsby Cloud to offer the same or something simliar to that experience regarding functions. I'd be happy to help provide more data, testing or feedback if needed. The first thing I set out to try was the Typescript support. Typescript support did not work for Gatsby functions. But I managed to solve it. It took me a while to figure out that when following one of Gatsbys getting started articles I ended up using a Gatsby starter that didn't install version The second thing I wanted to try was how the functions service handled headers. I am very keen on using cache-control headers properly to reduce function executions and accelerate our users experience. Proper cache header can make a huge difference in both regards. To my surprise functions in Gatsby currently don't support it on Gatsby Cloud. It works locally, I can control basically any header in the response locally. But on Gatsby Cloud the functions seem to be behind Varnish and no matter what I did I couldn't get it to respect my functions headers. Varnish seems to be configured to currently override the The third thing is support for
That's it for now during my simple quick test. I will continue to try function out and push them to their limits. I am very excited about this! My test function:
It is deployed at https://gswpgatsby.gatsbyjs.io/api/hello |
Beta Was this translation helpful? Give feedback.
-
I have a question about functions. |
Beta Was this translation helpful? Give feedback.
-
How can I deploy functions into Azure instead of Gatsby cloud? |
Beta Was this translation helpful? Give feedback.
-
Hello everyone! With Gatsby v3.7 (https://www.gatsbyjs.com/docs/reference/release-notes/v3.7) Gatsby Functions are available to everyone now. You can also use them on Gatsby Cloud now: https://www.gatsbyjs.com/blog/announcing-launch-of-functions-on-gatsby-cloud If you have questions or feature requests regarding Gatsby Functions, please use GitHub discussions: https://github.com/gatsbyjs/gatsby/discussions If you have found a bug, please report an issue: https://github.com/gatsbyjs/gatsby/issues/new?assignees=&labels=type%3A+bug&template=bug_report.md |
Beta Was this translation helpful? Give feedback.
-
Update (2021-06-09):
With Gatsby v3.7 (https://www.gatsbyjs.com/docs/reference/release-notes/v3.7) Gatsby Functions are available to everyone now. You can also use them on Gatsby Cloud now: https://www.gatsbyjs.com/blog/announcing-launch-of-functions-on-gatsby-cloud
We're introducing support for serverless functions in Gatsby and Gatsby Cloud. Learn more at the RFC at #27667
PR implemented in #30192
Full docs are at https://www.gatsbyjs.com/docs/how-to/functions/
How to use
Make sure your site has Gatsby v3.4 (or above) installed.
Add the
FUNCTIONS
flag to yourgatsby-config.js
:Start your develop server.
Write your first function at
src/api/hello-world.js
Run in your terminal
curl http://localhost:8000/api/hello-world
Glory in your functionalness.
Gatsby Functions are fully supported on Gatsby Cloud. If you're interested in helping add support for functions for other hosts, leave a comment.
Beta Was this translation helpful? Give feedback.
All reactions