Netlify Dev order of execution

Hello there,

I have a Gatsby site and some Netlify functions in the same repo. The Gatsby site uses the response from the functions (specifically a GraphQL one that uses apollo-lambda), and what I think that is happening is that the Gatsby site tries to hit the GQL endpoint before it’s ready.

That said, I’d like to know if:

  1. Is it possible to run the functions first, and then run the build command using netlify dev? If so, how can I do that?

  2. If that’s not possible, what could be a workaround? I imagine something like having two Netlify sites, one for the GraphQL function and another for the static site (which is kind of a bummer because that would make me have 2 deploy processes, etc)

Netlify Instance

Hi @alejandronanez,

You said “…before it’s ready.” but what’s the graphql endpoint that you’re trying ot hit? is it a local server? Please provide more details, as well as the source code so that you can get help. If you are trying to run a graphql server in a lambda function that’s running in the same dev instance, this will not be accessible at the time your gatsby server loads. you should instead query the data directly in your gatsby-node.js or use a live api endpoint or something similar.