Build A ChatGPT Clone with Strapi

The superpower of Strapi is that it is highly customizable and gives you the opportunity to add any additional functionality in code.

This is a companion discussion topic for the original entry at

In the “Creating our first controller” section. I seem to be getting hung up here:

const response = await getResponse(newSession, newSession.initialPrompt);

getResponse never actually returns anything, I never make it to the next line which is

response.sessionId = sessionId;

When I run the next.js app, I get the following error:

Unhandled Runtime Error

TypeError: Cannot read properties of undefined (reading ‘data’)

It is caused by the file: src\app\components\SideNav.tsx (15:17) @ data

How can I fix that?

I will take a look and see if I get the same error. Just quick question if you make the same request we are making from our Next js project via a postman are you able to see the results.

Hmm, that is interesting, you can try to compare the final code of the backend repo with what you have so far and see if there are any diferences.

Yes, in postman everything is working.
Also I think I found my mistake and that is…I wasn’t using the correct node version… it is working now.

Thanks for the tutorial Paul

@Julian_Wilden , I’m having the same issue. Which version of Node fixed this for you?

I am using now 20.3.1 for the frontend and 14.19.1 for the backend. I use nvm to switch the versions.

This is gold, thank you for sharing it, it helped me a lot!

1 Like

Glad you enjoyed it.