๐ช๐ต๐ ๐ฌ๐ผ๐๐ฟ ๐๐ ๐ฆ๐ฐ๐ฟ๐ถ๐ฝ๐๐ ๐๐ฟ๐ฎ๐๐ต
You copy a working AI script. You run it. It breaks.
The code is fine. Your setup is wrong.
Here are 5 common failures.
Module Errors. You see a SyntaxError with import. Node defaults to CommonJS. The SDK wants ESM. Add type: module to your package.json.
Fetch Errors. You see fetch is not defined. Your Node version is too old. Upgrade to Node 18.
TypeScript Errors. The compiler is green. Node fails at runtime. You use NodeNext. Add .js extensions to your imports.
Retry Loops. You add a retry loop. The SDK also retries. This wastes money. Use one layer only.
API Key Errors. Your key is undefined. You load dotenv too late. Use the --import flag to load keys first.
Stop guessing why your code fails.
Run a diagnostic script to check your runtime. Check your package.json and tsconfig.json.
The environment lies to you. Check your contracts first.