Search code examples
phpgoogle-cloud-platformgoogle-cloud-vision

Cloud Vision returns response 400


I am using a little bit older version of the PHP package of cloud-vision library, 0.19.0, because of some other dependency issues with other packages. This might be the cause of the problem, but I am not sure.

When working on localhost, I make a request and it all goes well, vision API returns the valid responses, but when I deployed to production, every time I try to use it, it just returns an error.

"message": "Request must specify image and features., "code": 3,"status": "INVALID_ARGUMENT","details": []

Is it the old package, or is something else the problem here? I ran out of ideas.

I am using a PHP library, so the code is pretty simple,I use the

file_get_contents($imageUrl)

and pass that string to the following functions enter image description here


Solution

  • The problem was with building the $imageUrl on local/dev and production. I am using AWS, so the $imageUrl on dev was different than production, and the production url is returning an access denied.

    Check your urls when working with AWS.