generateGptResponse error
Hi friends, I'm new to wasp so any help would be amazing! @Wasp Team
I'm running the generateGptResponse function as it came with the template and i'm receiving this error ([Server!] TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object), any clues on what could be going on here or how to fix it?
9 Replies
Hi @jtawf, thanks for trying out Wasp!
Could you provide some details about the error (e.g., where does it happen, how did you call the function, etc.)?
Which template were you using? 😄
hey guys sorry for the late reply, I'm using the saas pern template and the issue appears when making the call to the GPT api. I call the action through the front-end as well.
Hey. I created the template and never had any issues with that so far. Could you share the code that causes that error? Thanks!
of course @Vinny (@Wasp)! Just for context here I verified that my open api key is being properly used and I'm receiving the 'fetching' log that details my payload then the errors occurs when fetching the response and I don't receive the log detailing my response
and logs are here as well
if you're using
fetch
with Node on the backend, then you have to await
the JSON.
Check that you're doing the following after receiving the response:
I'm not sure if this is the issue, but give this a tryhmm okay, just gave it a try and still not working, does a better look at the try-catch within the function help?
Wohooo @jtawf, you just became a Waspeteer level 1!
hmmm... so I pulled up the GPT SaaS Template (https://github.com/wasp-lang/SaaS-Template-GPT) and gave it a try. everything seems to be working fine on my end. I did add a couple changes, but they weren't related to your problem. You can try it out yourself at https://saas-template-gpt-client.fly.dev/
The error you're getting
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object),
makes me think there is some kind of event listener. What wasp version are you on (run wasp version
)? Did you make any changes to the Saas Template? If so, can you share a github repo? if not, try cloning it and trying againGitHub
GitHub - wasp-lang/SaaS-Template-GPT
Contribute to wasp-lang/SaaS-Template-GPT development by creating an account on GitHub.