Skip to main content
Every code block on this site tells you what to write, not how to get it into a file. This page is that missing step — read it once, then every “create a file and paste this in” or “append this to the bottom of” instruction elsewhere means exactly the pattern below. To create a new file:
To append to an existing file (most snippets past the first one — they assume t3n/tenantDid/wasmComponent are already in scope from earlier in the same file):
Copy the whole block, including the cat line and the closing EOF — never just the code in between. Pasting only the TypeScript directly at your shell prompt doesn’t write a file at all; bash tries to run each line as a command instead. import { T3nClient, ... } becomes an attempt to run a program called import, T3nClient, becomes an unknown command, and every {/( produces a syntax error near unexpected token. If you see a wall of command not found / syntax error lines that look nothing like a TypeScript error, this is almost always what happened — nothing was written, so just redo the full block.
The delimiter must be quoted — << 'EOF', not << EOF. TypeScript’s non-null assertion operator (process.env.T3N_API_KEY!) contains a bare !, and bash’s interactive history expansion treats an unquoted ! as “repeat a previous command,” failing with -bash: !: event not found. Quoting the delimiter turns off expansion for everything inside the block. This bites people even inside a correctly-shaped cat << EOF if the quotes were dropped — always 'EOF'.
If you’d rather not think about quoting every time, disable the feature that causes it, once per shell session:
After that, << EOF and << 'EOF' behave identically for the rest of the session, and pasting a bare ! anywhere no longer triggers event not found. This doesn’t fix the separate “pasted at the prompt instead of into a heredoc” mistake above — only quoting (or a heredoc at all) does that.
Before running anything, it’s worth a quick sanity check that the file actually contains what you think it does — especially after a paste that might have gone wrong:
Then run it the same way every page in this guide expects: