More robust fix

This commit is contained in:
Steve Faulkner 2020-06-09 16:29:41 -05:00
parent b62cd98f67
commit 3951f01422
2 changed files with 4 additions and 1 deletions

View File

@ -49,7 +49,9 @@ export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) =>
export const endpoint = () => {
if (config.platform === Platform.Emulator) {
return config.EMULATOR_ENDPOINT || window.parent.location.origin;
// In worker scope, _global(self).parent does not exist
const location = _global.parent ? _global.parent.location : _global.location;
return config.EMULATOR_ENDPOINT || location.origin;
}
return _endpoint || (_databaseAccount && _databaseAccount.properties && _databaseAccount.properties.documentEndpoint);
};

View File

@ -106,6 +106,7 @@ function createDocumentsFromFile(fileName: string, documentContent: string): voi
triggerCreateDocument(content);
}
} catch (e) {
console.log(e);
recordUploadDetailErrorForFile(fileName, e.message);
transmitResultIfUploadComplete();
}