this.transport is not a constructor error on subscriptions
See original GitHub issueBug report
When trying to connect to a subscription through Supabase, it throws an error, stating
[Vue warn]: Unhandled error during execution of setup function
at <App>
ERROR [worker] this.transport is not a constructor 10:10:52
at RealtimeClient.connect (.nuxt/dist/server/server.mjs:6101:21)
at SupabaseQueryBuilder.on (.nuxt/dist/server/server.mjs:4612:28)
at setup (.nuxt/dist/server/server.mjs:8802:22)
at _sfc_main.setup (.nuxt/dist/server/server.mjs:8821:23)
at callWithErrorHandling (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:157:22)
at setupStatefulComponent (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6977:29)
at setupComponent (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6933:11)
at renderComponentVNode (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:198:17)
at Module.ssrRenderComponent (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:629:12)
at default (.nuxt/dist/server/server.mjs:8260:37)
Describe the bug
It seems to generate anytime a subscription is initiated. I even attempted to import the realtime-js library direction instead of through the nuxt3 supabase module and it produced the same error.
Here is the code I used to generate the error. Everything else was initial project generated code.
app.vue
<script setup lang="ts">
const client = useSupabaseClient();
client.from("*").on("*", (payload) => {
console.log("Change received!", payload);
});
</script>
<template>
<div></div>
</template>
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Setup a new project for Nuxt3
- Add in Nuxt3 module for Supabase and add in your environment variables.
- Replace app.vue with the example above.
- Run
yarn dev
and navigate to site.
Expected behavior
The subscription should make the connection and perform as expected.
Screenshots
System information
- OS: macOS
- Browser (if applies) firefox, safari
- Version of supabase-js: 1.33.2
- Versoin of realtime-js: 1.6.0
- Version of Nuxt: 3.0.0-27480376.fdd38f9
- Version of Node.js: 16.14.2
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
this.transport is not a constructor error with realtime #7720
I am attempting to enable realtime in my nuxt 3 application. I have copied exact code from documentation and also enable replication on...
Read more >Socket.io TypeError: this.transport is undefined - Stack Overflow
It states that "When configure() is called without an environment flag it will run in every environment." "this.transport is undefined" error ...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >Solved: TypeError: clazz is not a constructor - Esri Community
i have two user defined functions.When i declare and call them i get this error.i dont know why it is happening .please help...
Read more >Subscriptions in Apollo Server - Apollo GraphQL Docs
If no user exists or the lookup otherwise fails, our resolvers can throw an error and the corresponding subscription operation is not executed....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same problem and I think it is due to SSR. You want the subscription to take place clientside. Thus, I wrapped it in the onMounted hook like this and it works for me:
@justinleapline no problem!
can you please try
realtime-js@v1.4.2
and thenrealtime-js@v1.4.3
? i’m trying to isolate the issue.