Reference Error: Cannot access "..." before initialization

Please help. I'm getting this error: ReferenceError: Cannot access 'defaultAddressSchema' before initialization at Object.defaultAddressSchema (/home/megamindat/Desktop/learning/CCH_backend/src/db/schema/address.ts:1:1) at Object.get [as defaultAddressSchema] (/home/megamindat/Desktop/learning/CCH_backend/src/db/schema/address.ts:14:45) at Object.<anonymous> (/home/megamindat/Desktop/learning/CCH_backend/src/db/schema/order.ts:127:31) at Module._compile (node:internal/modules/cjs/loader:1233:14) at Module._compile (/home/megamindat/Desktop/learning/CCH_backend/node_modules/drizzle-kit/bin.cjs:11802:30) at Module._extensions..js (node:internal/modules/cjs/loader:1287:10) at Object.newLoader [as .ts] (/home/megamindat/Desktop/learning/CCH_backend/node_modules/drizzle-kit/bin.cjs:11806:13) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19)
Error
4 Replies
megamindat
megamindat2w ago
These are the files associated.
megamindat
megamindat2w ago
Hello @Raphaël M (@rphlmr) ⚡ @Angelelz : Please help, thank you! 🙂
Angelelz
Angelelz2w ago
This type of error usually happen with circular references I’d suggest you bring your schema to one file, and then start separating slowly
megamindat
megamindat2w ago
Oh, I'll try that. Thanks for the quick reply @Angelelz Cool, that solves my issue for now.
Want results from more Discord servers?
Add your server