Support Forums

How to call another Netlify function within a Netlify function?

I have a Netlify function for refreshing an access token and it’s needed in a couple of scenarios. I’d prefer to handle the different scenarios in separate Netlify functions. As in, different function files, then call the refresh function when it’s needed.

I’m sure this is possible but I can’t get past a 404 error. I’ve tried a few but I’m expecting this to be fine:

`const refreshFunctionUrl = ‘/.netlify/functions/refresh’

You can’t use relative URLs inside Netlify Functions - that’s something that browsers can resolve, functions can’t. If you use absolute URL, that should do fine.