brillout / telefunc

Remote Functions. Instead of API.
https://telefunc.com
MIT License
690 stars 31 forks source link

Cannot access telefunc return before initialization with SvelteKit #58

Closed jessielaf closed 1 year ago

jessielaf commented 1 year ago

Hi,

I am trying to throw an error when validation permissions are not met but I am getting an error:

ReferenceError: Cannot access 'telefunctionReturn' before initialization
    at onError (C:\Users\Jessie\projects\boiler\boiler-new\node_modules\telefunc\dist\cjs\node\server\runTelefunc\executeTelefunction.js:18:32)   
    at executeTelefunction (C:\Users\Jessie\projects\boiler\boiler-new\node_modules\telefunc\dist\cjs\node\server\runTelefunc\executeTelefunction.
js:30:9)
    at runTelefunc_ (C:\Users\Jessie\projects\boiler\boiler-new\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:111:156)
    at async runTelefunc (C:\Users\Jessie\projects\boiler\boiler-new\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:37:16)
    at async Proxy.telefunc (C:\Users\Jessie\projects\boiler\boiler-new\node_modules\telefunc\dist\cjs\node\server\telefunc.js:11:26)
    at async GET (/src/routes/_telefunc/+server.ts:6:20)
    at async render_endpoint (file:///C:/Users/Jessie/projects/boiler/boiler-new/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js:42:20) 
    at async resolve (file:///C:/Users/Jessie/projects/boiler/boiler-new/node_modules/@sveltejs/kit/src/runtime/server/index.js:354:17)
    at async respond (file:///C:/Users/Jessie/projects/boiler/boiler-new/node_modules/@sveltejs/kit/src/runtime/server/index.js:229:20)
    at async file:///C:/Users/Jessie/projects/boiler/boiler-new/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:458:22

It happens when I try to create a new object using a telefunc function. If you need more context, please let me know. I am also willing to share my repository with you.

brillout commented 1 year ago

Fix released in 0.1.43. Let me know if you still run into any issue.