The Core Problem
A common debugging mistake is deploying five times to fix the same bug, when a single log line plus one deployment would have shown you the root cause immediately. If you’re patching against test failures rather than the actual return shape, stop and add aconsole.log first — then deploy once.
The 5-Step Debug Loop
1
Add a console.log to the suspicious spot
Log the actual value — not a guess, the real thing:Log the entire object so you see the actual shape, not what you assumed it would be.
2
Push to sandbox (not production)
lua chat compiles and uses your local code directly. Use this for rapid iteration before committing to a push.3
Send ONE test message
4
Check logs immediately
console.log output appears in the log message body. Look for the 🔍 DEBUG or ℹ️ INFO entries — they contain your logged values.Example output:5
Fix once, not five times
You now know:
- Exact shape of the return value
- Which fields exist (and which don’t)
- What the actual values look like
lua logs. Repeat until correct.Suppressing CLI hints
All post-action hints can be silenced with:LUA_NO_HINTS=true (or yes) in your shell profile or CI environment to disable hints globally. This is useful in CI/CD pipelines that capture only command output.
Reading lua logs Output
Log entry anatomy
Log types
Filter by component type
When to Use lua test vs lua chat vs lua logs
console.log Debugging Patterns
Log a full API return value
Log individual entries
Log before and after transformation
Common Bugs and How to Spot Them
Bug: results.data is undefined (Data.search)
results.data would be undefined — there is no .data wrapper on the array. Use results[0].data.title for the entry payload, or results[0].title via the Proxy shortcut.
Bug: entry.title is undefined (Data.get)
entry.title would be undefined — Data.get entries are raw, not proxied. Use entry.data.title.
Bug: products.data is undefined (Products.search)
results.data doesn’t exist on ProductSearchInstance. Use results.products or results.map(p => p.name).
Removing Debug Logs Before Production
Once the bug is fixed, clean up your logs. Production logs are visible to your whole team and consume log storage.Related
lua logs Command
Full reference for the logs command and all filter options
lua test Command
Test tools locally before pushing
Data API
Data API return shapes reference
Troubleshooting
Common errors and solutions

