Hello, I recently started opening up my application to a small group of test users (about 20 people). At first I thought everything was going great because a few of them made an account and started generating completions within minutes of signing up. However once a larger sample of the test group started to sign up, I got text messages, emails, and chat box requests, from some users, claiming that when they click the button to generate a completion - absolutely nothing happens.
One user was on an android and it wasn’t working… One user was on an android and it was.
One user was able to use the tool I built on their apple iphone, but when they tried it on their Mac computer, no completion would pop up. Both of these devices were on the same network.
It seems that there is absolutely no rhyme or reason to what causes the Open AI API to not connect or do anything for some users but not others. I’m building my app on react/node js/express and I’m a brand new developer so this has been a tricky one for me.
Turns out, between all 20 users that tested the application - it didn’t work for 8 of them. And when I say “it” didn’t work, i mean the Open AI completion. Everything else in my app works perfectly for them, however when they actually interact with the Open AI API through my user interface (buttons, input forms, etc) they get absolutely no output.
Does anyone have any idea what could be causing this error? Is this likely to be on my end or Open AI’s end? Could this have something to do with the hosting I’m using (heorku free trial)?
I’ve been working on this non-stop since I sent the link out to my users. It is funny that you’ve just replied as I came here to respond. Great timing and I appreciate you lending a hand.
I haven’t fixed the error yet, but I found what is causing it which is a huge weight off my shoulders. I was able to replicate the error using a device/browser testing website that lets you test your app on older version of chrome, windows, iOS etc.
So far, this is the error that seems to be preventing a large number of users from accessing the API. I have only just found out about this error minutes ago, so I have not yet started working on a solution - wanted to post here first. I am sure I will find the solution momentarily.
However if I do not I would appreciate any feedback on advice in regards to this screenshot here -
Looks like you’re making your call to OpenAI from the front end and it’s violating the content security policy (trying to make an ajax request to another domain). Managing content security policies can be a pain sometimes, and it’s almost always going to be easier to make your API calls from your NodeJS back end than your React front end.
yes you really need a server running in between. Currently (assuming that you’re indeed calling openAI from your frontend javascript) you’re also exposing your API key, which might get very costly if someone steals it. I’d advise you to immediately put the website offline and port the openai api access to a server side component.
@cody@oliver You guys are awesome! Thank you very much for your willingness to reach out and offer your input. I am moving my API calls over to my NodeJS backend and I am confident this will fix it.
You guys are seriously the best, cheers and have a great week
Any sort of server should be handling these calls in the back-end where the client has no control over the settings. The security policies in place to prevent these things from happening are vicious, but necessary. Your error messages are indicating that.
Instead of Client → OpenAi, it should be
Client → Your server → OpenAi
Edit, sorry I just read the rest of the conversation. This has already been said.