a year ago
I am receiving this error:
Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fc9f33f9540>: Failed to resolve 'api.openai.com' ([Errno -3] Lookup timed out)"))
It keeps saying it cannot connect to the api. I don't think its an issue with my api keys, because I included a .env file in the build and put it in the environment variables of my project.
I think it may be a network issue. Do railway instances have access to the internet, or is there any sort of blocking involved?
21 Replies
a year ago
Yes services on Railway have full access to the internet, we do not block any outgoing traffic nor do we even have the ability to.
I am able to resolve that domain just fine - https://utilities.up.railway.app/dns-lookup?value=api.openai.com&type=ip
This means it's an issue with your application or config, to be able to help here we would need a minimal reproducible example.
a year ago
What do you mean by minimal reproducible example?
a year ago
Also, my frontend deployed application does not accurately send a post req to my backend, but when i run it locally with the same urls it sends it. This doesn't make sense to me.
a year ago
I'll do that. But now that I htink about it, I don't know if my environment variables are just setup properly. I dont know if there could be any other issue. I kept a .env file in my directory with my open ai key and then deployed that to production. Does that work with Railway?
a year ago
While Railway doesn't do anything to prevent you from using an .env file, please never deploy with an .env file, you need to be using service variables.
https://docs.railway.app/overview/the-basics#service-variables
a year ago
Okay, gotcha.
As for the example, do you have the ability to ssh into these instances and run a python script? If so, I'll do that. Additionally, to replicate this error it seems like you'd need an OPEN_AI_KEY to even test it. Is there anyway I can send that to you without it being public
a year ago
A simple open ai chat request works on my own computer but when i try to do it on my deployed app it gives me the initial error.
a year ago
I do technically have the ability to do SSH into a container, yes, but we do not provide a way for our users do that, nor is that a level of support I can provide.
I can acquire my own API key, no need to share yours.
a year ago
Sounds good. However, I'm not sure how to test this issue without the ability for you to SSH into the container. Do you have access to my project?
a year ago
I do, but I don't see why I need that, you need to provide me a minimal reproducible example that I could deploy myself on my own account.
a year ago
Okay. Here's a file that you can use in deployment. I additionally attached requirements.txt and a dockerfile.
Attachments
a year ago
By auth do you mean the api key? At least for the new installation of pip openai, it says to set the environment variable "OPENAI_API_KEY". I just set this as a service variable in my deployment.
a year ago
What do you mean?
a year ago
Yea, I passed it in now and still get the same issue.
a year ago
I tested if there was a connection to the internet. Doesn't look like it!
Attachments
a year ago
So, it wouldn't be able to install the pip packages in my Dockerfile unless there wasn't internet. That must mean there is some sort of blocking I believe
a year ago
Can I have some help here?
a year ago
As rc stated in another thread, the issue connecting to google is an application / code level issue, we don't provide coding assistance so we can't help with that.
The OpenAI issue is likely them blocking GCP, this is also out of our hands, you would need to get in contact with OpenAI.
I'm sorry we can't help further.
Status changed to Closed brody • 11 months ago