Unstructured-IO / unstructured-api

Apache License 2.0
429 stars 94 forks source link

Running the docker image results in block from API Key #407

Closed Bryson14 closed 2 months ago

Bryson14 commented 2 months ago

Describe the bug A clear and concise description of what the bug is. After pulling the docker image, I followed the instructions to get the docker container running:

docker run -p 8000:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0

The container can online and then i tried to send a local PDF file to it:

time curl -k  -X 'POST'   'https://api.unstructured.io/general/v0/general'   -H 'accept: application/json'   -H 'Content-Type: multipart/form-data' -H 'unstructured-api-key: WOW-123'   -F 'files=@MFA (PingID) Team-080424-212425.pdf'
{"detail":"API key is malformed, please type the API key correctly in the header."}
real    0m12.155s
user    0m0.026s
sys     0m0.000s

Two things stick out to me. The system is asking for a API key even though I never set it from the docker run command. And 2, why did the response take 12 seconds?

So I tried to set the api key explicitely:

docker run -p 8000:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0 -e "UNSTRUCTURED_API_KEY=abc123"
2eba885dceffdd3d223afe8bf0d47dc3bb7c3c55962dcd6b5ee81a03e4c2b1e5

But I still get this error:

time curl -k  -X 'POST'   'https://api.unstructured.io/general/v0/general'   -H 'accept: application/json'   -H 'Content-Type: multipart/form-data' -H 'unstructured-api-key: abc123'   -F 'files=@MFA (PingID) Team-080424-212425.pdf'
{"detail":"API key is malformed, please type the API key correctly in the header."}
real    0m12.057s
user    0m0.000s
sys     0m0.028s

So where do i set this key and why is it required by default in the container?

To Reproduce Please provide as much info as possible:

Pull the unstructed-api image at tag 5cbd99e2e18364aced1c62e02e923b9c29f38462b24b232a4ae7eef584e13a3c.

Send a data file like a PDF and see the same respond about api keys.

Environment:

Additional context Add any other context about the problem here.

awalker4 commented 2 months ago

Hi there, it looks like your curl request is going to our free hosted api rather than your container. Instead of https://api.unstructured.io/general/v0/general, you'll want to use http://localhost:8000/general/v0/general. As for the 12s, it would seem to be upload time for the pdf since the server didn't do any processing past returning 401. Let me know if it's also showing delays running locally.

Bryson14 commented 2 months ago

Yes I just saw that. Thanks for dealing with my stupidity! haha

awalker4 commented 2 months ago

All good! 😂 Glad it's working now