Storage using private by default
See original GitHub issueDescribe the bug
It seems that since #2898 was merged, the default storage level is now private
. I think that the issue is not making the change on a copy, but directly on the configuration coming from StorageClass
(see “Addition context” for details).
To Reproduce Steps to reproduce the behavior:
- Configure Amplify with storage enabled
- Get or store something with the Storage object.
Expected behavior
With no special configuration, public level should be used (unless Storage.vault
is used).
Actual behavior The private level is used.
Desktop (please complete the following information):
- OS: Linux
- Browser Chrome
- Version 1.1.26 (Storage object is gotten through the Amplify-Angular service, version 2.1.12 but I don’t think that’s really related)
Additional context The relevant code seems to be here (from packages/storage/src/index.ts)
logger.debug('storage configure called');
const vaultConfig = old_configure.call(_instance, options);
// set level private for each provider for the vault
Object.keys(vaultConfig).forEach((providerName) => {
if (typeof vaultConfig[providerName] !== 'string') {
vaultConfig[providerName] = { ...vaultConfig[providerName], level: "private" };
}
});
logger.debug('storage vault configure called');
_instance.vault.configure(vaultConfig);
When stepping through , it’s pretty clear that _instance._config
is updated along with the one used for the vault. AFAIK, _instance is the actual Storage object (which would explain why everything is loaded using the private level since I updated to the latest version).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14 (11 by maintainers)
Top GitHub Comments
@LosD thank you so much for finding this, I could reproduce it after calling
configure
a second time. You can test this using the@unstable
tag.Sure, though it’ll have to wait until tomorrow. I might do better and make a testcase and a fix. Should be simple.