Calling Pages Function from another Pages Function

Hey there,
according to https://developers.cloudflare.com/workers/platform/bindings/about-service-bindings/ and https://developers.cloudflare.com/pages/platform/functions/bindings/#service-bindings,
One can call a worker from within another worker or a Pages Function using service-bindings.

Is there a way to use service-binding to call a Pages Function from within another Pages Function or a worker?

I couldn’t find a way to create a service binding for a Pages Function.

If it’s not possible, are there plans to implement it and if there a workaround?

Thanks,
Alexey

Unfortunately you can not use Service Bindings to bind another Pages Function. From within a Pages Function, you can only service bind to a Worker.

As for a workaround, you could expose an endpoint on example.pages.dev/something and then simply fetch that from another Function / Worker.

2 Likes

That would introduce latency, which service-binding intends to solve.
Anyway, thanks for the answer!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.