3

I have netlify functions setup in my gatsby project with proxying and so forth. If i deploy through netlify everything works as expected. If I do another deploy with gatsby cloud it actually removes my netlify functions from netlify.

I have tried setting up the functions through the netlify UI and with a toml. It all works if I deploy through Netlify, but when I do a deploy with gatsby cloud the netlify-functions disappears again.

Not sure if code is relevant here – but let me know and I'll share.

Steps to reproduce

  • Setup gatsby project with gatsby-plugin-netlify-functions
  • Follow these instructions
  • Add site to Netlify and deploy
  • Check if functions are working
  • Add site to gatsby cloud
  • Add netlify deploy integration
  • Deploy to netlify
  • See if functions are working or if they have disappeared

1 Answers1

0

This feature is now available on Gatsby Cloud.

For now how we are handling this is that we will deploy any functions found in /public/functions after gatsby build.

If you are still using the gatsby-plugin-netlify-functions plugin, setting the functionsOutput setting to ${__dirname}/public/functions should get your functions deployed.

If not, you can you hook into onPostBuild in gatsby-node.js and copy the files there. (That's what gatsby-plugin-netlify-functions is doing behind the scenes!)

duffn
  • 3,690
  • 8
  • 33
  • 68
  • Is this still the case? according to https://joshwcomeau.com/gatsby/netlify-functions-and-gatsby-cloud/ they should be getting deployed from `/functions` - though I'm not entirely sure if this will work with un-bundled functions - it doesn't appear to work at all for me at least. – Guy Bowden Jul 21 '20 at 14:01
  • @GuyBowden `/functions` does not work, but `/static/functions` does. – duffn Aug 08 '20 at 13:54