I ran into an assertion in S3Storage trying to reproduce the problem in
MCOL-3976. My acct didn't have the assume-role permission, so ms3_init_assume_role() failed, and getConnection() returned NULL. The NULL went into ScopedConnection, which asserts on NULL.
The change to make here is to check the return value from getConnection(), and if NULL, return an error (set errno to something appropriate and return -1).