Skip to content

Commit d65baf6

Browse files
authored
Merge pull request #666 from subquery/revert-661-sandbox-differences
Revert "Better document sandbox differences and polyfills option"
2 parents 728e136 + f1cb664 commit d65baf6

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

docs/indexer/build/mapping/sandbox.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,10 @@ export async function handleTransaction(
9393

9494
## Other differences and incompatibilities
9595

96-
The SubQuery sandbox doesn't have all the same global variables as you would expect in a normal Node.js environment. This might cause some issues with certain packages. To get around this you can use polyfills for some of the missing globals.
97-
98-
To set this up you can create a file called `./src/polyfill.ts` or `./src/polyfills.ts` and update the global object with your required polyfills.
99-
10096
* `TextEncoder` and `TextDecoder` are not available by default. If your handlers or a dependency need these they can be polyfilled like so:
10197
```ts
102-
// ./src/polyfill.ts
103-
// Add `text-encoding` as a dependency.
98+
// Add `text-encoding` as a dependency and include this code in index.ts before any other imports
10499
import { TextDecoder, TextEncoder } from 'text-encoding';
105100
global.TextEncoder = TextEncoder;
106101
global.TextDecoder = TextDecoder;
107102
```
108-
109-
* `fetch` is also not available by default. This will also require using the `--unsafe` flag to get access to http. If your handlers or a dependency need this you can polyfill it like so:
110-
```ts
111-
// ./src/polyfill.ts
112-
// Add `node-fetch@2.7.6` as a dependency.
113-
import { fetch } from 'node-fetch';
114-
(global as any).fetch = fetch;
115-
```

0 commit comments

Comments
 (0)