Skip to content

Commit

Permalink
Fix usage in browser (#574)
Browse files Browse the repository at this point in the history
Variable `process` isn't present in browser
  • Loading branch information
jakubno authored Feb 5, 2025
2 parents 7c38aa1 + 5749120 commit 0cc2b2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-planets-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'e2b': patch
---

Fix browser usage
4 changes: 4 additions & 0 deletions packages/js-sdk/src/api/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const defaultHeaders = {
}

export function getEnvVar(name: string) {
if (typeof process === 'undefined') {
return ''
}

if (runtime === 'deno') {
// @ts-ignore
return Deno.env.get(name)
Expand Down

0 comments on commit 0cc2b2f

Please sign in to comment.