Netlify dev changes proxy port eveytime it runs

Ok, I am using Gatsby JS and pre-fetching data from a netlify function at build time using a source plugin I wrote. The problem here is when I run netlify dev the server on http://localhost:8888 is not yet ready.
// gatsby-node.js
const fetchRandomUser = () => axios.get('localhost:8888/.netlify/functions/appointment-types')

How can I pre fetch data from a function locally at build time?? Since the functions server IS available before the build process, however it has a random changing port now so can’t use it…