Closed samuba closed 11 months ago
You can only reproduce when using SvetleKit's split
feature, correct? So I guess it's more of SvelteKit issue than a Telefunc one?
I just doubled checked the assertion, and everything looks correct on Telefunc's side.
Closing but let's re-open if there is some evidence it's related to Telefunc.
The split feature is just splitting the code into one function per route. The gist of it is that telefunc code runs in an edge function and wrongfully detects that it is running in the browser. I don't see how sveltekit could be responsible for this.
How do you detect if the import is in a browser context?
Feel free to dig yourself and PR welcome. But, again, I really doubt it's related to Telefunc.
Can you point me to where browser context detection happens?
Search for the assertion message.
On Tue 2. Jan 2024 at 16:15, samuba @.***> wrote:
Can you point me to where browser context detection happens?
— Reply to this email directly, view it on GitHub https://github.com/brillout/telefunc/issues/98#issuecomment-1874155273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHVQRUJD4ULT5BZ3SVKKMTYMQQALAVCNFSM6AAAAABBKCASR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGE2TKMRXGM . You are receiving this because you modified the open/close state.Message ID: @.***>
When running the starter sveltekit project on vercel edge function with the split option enabled, telefunc calls fail with the following error inside vercel. Somehow telefunc thinks the code is executed in a browser while it is running in the edge function.
Interestingly this does not happen if the whole project is bundled in a single edge function. It only occurs when splitting into multiple function is enabled or if you configure some routes explicitly to be deployed in an edge function.
Code to reproduce: https://github.com/samuba/telefunc-vercel-edge Its a sveltetkit starter project with an additional telefunc file and the edge deployment configuration.