Skip to content

Commit

Permalink
Fixes #140 Unable to configure localStorage polyfill when running und…
Browse files Browse the repository at this point in the history
…er AWS Lambda functions
  • Loading branch information
niemyjski committed Oct 24, 2023
1 parent 8d28760 commit 7b87730
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/node/src/NodeExceptionlessClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ export class NodeExceptionlessClient extends ExceptionlessClient {
const config = this.config;

if (configurationOrApiKey && !this._initialized) {
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless'));
config.useLocalStorage = () => storage;
config.services.storage = storage;
try {
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless'));
config.useLocalStorage = () => storage;
config.services.storage = storage;
} catch (ex) {
this.config.services.log.info(`Error configuring localStorage polyfill: ${ex instanceof Error ? ex.message : ex + ''}`);
}

config.addPlugin(new NodeEnvironmentInfoPlugin());
config.addPlugin(new NodeGlobalHandlerPlugin());
Expand Down

0 comments on commit 7b87730

Please sign in to comment.