I’m setting up an automated droplet creation process in Laravel for an automated deployment setup package I’m making for myself. But for reasons I can’t figure out, I keep getting the error: “You specified an invalid image for Droplet creation.”, when I try to actually create the droplet. I can’t determine if this is a shortcoming of the API, or a flaw in my own logic.
Currently, the process flow looks like this:
min_disk_sizeis greater than or equal to the selected disk size.
In other words, by the time a region is chosen, I have what should be, in my mind, a perfectly valid selection of droplet size, image, and region. Some other input occurs, like droplet name and SSH keys, and then I post the information. But I consistently get the error that my chosen image is invalid, every time.
I’ve tried multiple combinations of regions, images, and sizes, and I’ve tried posting the image as both the slug and the ID. So far, no change in behaviour.
I’ve seen this question: https://www.digitalocean.com/community/questions/api-v2-you-specified-an-invalid-image-for-droplet-creation, and it seems like their issue was - annoyingly - that the API just wouldn’t work the first few calls, and would need to be called multiple times. This was 3ish years ago now. I certainly hope the issue hasn’t remained unresolved this whole time.
Any thoughts on what could be going wrong here? Is there additional ‘validation’ logic of which image is valid for which region/droplet combination that the API won’t give me? I really don’t want to hardcode any values, as I should be able to obtain valid selections purely through the API.
For reference, here’s an example of what I’m posting to the API:
[ 'name' => 'Testing', 'region' => 'nyc1', 'size' => '512mb', 'image' => 'ubuntu-14-04-x64', 'ssh_keys' => [ 0 => 'key_id' ], 'backups' => true, 'tags' => [ 0 => 'Tag 1' ] ]
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!