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)
4 Replies
These are the files associated.
Hello @Raphaël M (@rphlmr) ⚡ @Angelelz : Please help, thank you! 🙂
This type of error usually happen with circular references
I’d suggest you bring your schema to one file, and then start separating slowly
Oh, I'll try that. Thanks for the quick reply @Angelelz
Cool, that solves my issue for now.