typebot.io icon indicating copy to clipboard operation
typebot.io copied to clipboard

undefined error on typebot-js when importing default

Open baptisteArno opened this issue 1 year ago • 7 comments

Discussed in https://github.com/baptisteArno/typebot.io/discussions/125

Originally posted by seabysalt September 5, 2022 Hey I have no idea why but for some reason, I am struggling to embed my typebot in my next.js application. I am always getting the following error:

Screenshot 2022-09-05 at 16 14 52

However, I am correctly importing Typebot at the top with import Typebot from "typebot-js";

and I can also see that "typebot-js": "^2.2.9" is correctly installed as a dependency in my package.json via npm... Is there something broken? @baptisteArno

baptisteArno avatar Sep 06 '22 05:09 baptisteArno

A workaround is to directly import the function:

import { initContainer } from 'typebot-js'

baptisteArno avatar Sep 06 '22 05:09 baptisteArno

thanks! I had actually tried this before as I also thought it could be a solution but for me this wasn't working & still isn't... How come this fix worked for you?

seabysalt avatar Sep 06 '22 15:09 seabysalt

thanks! I had actually tried this before as I also thought it could be a solution but for me this wasn't working & still isn't... How come this fix worked for you?

You get the same error?

baptisteArno avatar Sep 07 '22 09:09 baptisteArno

Yes, I do… I tried different things but it looks like it is not detecting initContainer. I also de-installed and re-installed your package but nothing working so far… please let me know once you fixed this issue. I was about to completely switch to your solution for my platform but I would need this to be working of course and I really cannot figure out why…

Thanks so much in advance!

On 7. Sep 2022 at 11:01:15, Baptiste Arnaud @.***> wrote:

thanks! I had actually tried this before as I also thought it could be a solution but for me this wasn't working & still isn't... How come this fix worked for you?

You get the same error?

— Reply to this email directly, view it on GitHub https://github.com/baptisteArno/typebot.io/issues/126#issuecomment-1239111117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDMF7CE3HKVBRUIYN5GGQ3V5BKVXANCNFSM6AAAAAAQFPOH54 . You are receiving this because you commented.Message ID: @.***>

seabysalt avatar Sep 07 '22 09:09 seabysalt

This totally works:

import { initContainer } from "typebot-js";

const Home: NextPage = () => {
  useEffect(() => {
    initContainer("id", {
      url: "https://viewer.typebot.io/null",
    });
  }, []);

Can you paste your code?

baptisteArno avatar Sep 07 '22 09:09 baptisteArno

Totally, my bad. I forgot to remove the “Typebot.” before initContainer 🙈 It's working perfectly now. Thanks so much! Then I will now pursue with my upgrade… Guess, there is no chance I could maybe get like a discount? 😌☺️

On 7. Sep 2022 at 11:18:17, Baptiste Arnaud @.***> wrote:

This totally works:

import { initContainer } from "typebot-js"; const Home: NextPage = () => { useEffect(() => { initContainer("id", { url: "https://viewer.typebot.io/null", }); }, []);

Can you paste your code?

— Reply to this email directly, view it on GitHub https://github.com/baptisteArno/typebot.io/issues/126#issuecomment-1239130372, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDMF7DAQGCFBUOUQHCQ67LV5BMVTANCNFSM6AAAAAAQFPOH54 . You are receiving this because you commented.Message ID: @.***>

seabysalt avatar Sep 07 '22 11:09 seabysalt

For spotting a bug? 😃

On 7. Sep 2022 at 13:21:06, Sarah Alt @.***> wrote:

Totally, my bad. I forgot to remove the “Typebot.” before initContainer 🙈 It's working perfectly now. Thanks so much! Then I will now pursue with my upgrade… Guess, there is no chance I could maybe get like a discount? 😌☺️

On 7. Sep 2022 at 11:18:17, Baptiste Arnaud @.***> wrote:

This totally works:

import { initContainer } from "typebot-js"; const Home: NextPage = () => { useEffect(() => { initContainer("id", { url: "https://viewer.typebot.io/null", }); }, []);

Can you paste your code?

— Reply to this email directly, view it on GitHub https://github.com/baptisteArno/typebot.io/issues/126#issuecomment-1239130372, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDMF7DAQGCFBUOUQHCQ67LV5BMVTANCNFSM6AAAAAAQFPOH54 . You are receiving this because you commented.Message ID: @.***>

seabysalt avatar Sep 07 '22 11:09 seabysalt