-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typeform API client not compatible with Cloudflare workers / Vercel edge runtime #94
Comments
Hello @magnuslundin can you please show us how you are using the library? How do you import it? The Also, the axios dependency was updated recently. Please try with the latest version of the lib. |
I'm using the library in a SvelteKit project deployed on Vercel. The typeform api client works well with the regular serverless functions (node). When I switched to using their Edge functions, which are utilizing CloudFlare workers the library generated the errors described above. I'm currently circumventing this by forcing the specific part of the app that uses your library to use the serverless runtime. Nice that the dependency is updated. I'll give it a go. Edit: updated problem explanation |
Please let us know if the problem still remains with the latest version. |
I just noticed you mentioned a different Typeform library - Embed SDK. This library is not intended to be used server side. However when used with eg. NextJS it should render an empty div server-side and populate it with the embed (iframe with your typeform) when rendered client side - see React NextJS demos. If the issue persists please raise it in embed SDK with details. |
Hi @mathio, I've updated my comment above with the actual issue I was facing. Version 1.15.0 of the client has now been tested with the same result. Axios does not play well on cloudflare workers. |
Thank you. I dont have much experience with Cloudflare workers, but I can test with Vercel. |
I'm getting the same error on nextjs server side. Is there an API client for server side? |
No, there isn't. We have to make due creating our own implementations from this: |
Thank you! I was able to make it work by using fetch calls to the API directly, and cast the response to the types defined in this library. |
The current version of the Typeform API client does not run well on a Cloudflare worker / Vercel edge runtime. Creating a client result in the following error:
This is most probably caused by the (3 year old..) dependency to Axios. A switch to fetch should not only resolve the compatibility issue, but render the project free from build dependencies.
The text was updated successfully, but these errors were encountered: