Troubleshooting App Context Injection Issues in TypeScript

i just can't get this thing to behave and it makes absolutely no sense to me why it isn't. ill start with my overall app context that gets injected into my app runtime...

const AppContext = Layer.mergeAll(
  EnvService.Layer,
  StorageService.Layer,
  TokenCache.Layer, // StorageService, EnvService
  AuthService.Layer,

  // only referenced inside authenticated routes (session in storage)
  HttpClient.Layer, // TokenCache
  ProductService.Layer, // HttpClient
);


heres the scope of what should happen in a perfect world assuming no session is in local storage

1. user goes to website, inputs credentials
2. AuthService logs user in, and uses StorageService to store the incoming session in local storage
3. The user is redirected to their home page on successful login
4. As the redirect occurs, the home pages route loader uses ProductService to fetch data

but whats happening, is after the login is successful (200 http code AND the bloody session is in storage), when the TokenCache is referenced for the first time inside the HttpService that gets injected into the ProductsService, it errors saying there is nothing in local storage...[insert incoherent screaming here]
Was this page helpful?