Context isn't required in all cases, though the case where it's not required is pretty specific. Context is used to ensure that attachment permissions and limits are applied in the expected way. The context can be skipped if you're bypassing permissions, though I think there might actually be a bug there that I need to look into. I'd recommend passing the context, even if you do choose to bypass permissions.
The expected context for an attachment when creating a new resource would be context[resource_category_id]
with the ID of the category you're creating the resource in as the value. (The content type would be resource_version
for the file itself; if you're trying to add screenshots to the description, resource_update
.)
Note that if you're trying to add a new version/create a new resource update to an existing resource the context would be context[resource_id]
with the relevant resource ID. (Generally speaking, attachment contexts always use the most specific bit of data we have at the time, since we're uploading attachments before the related content has actually been inserted.)