I’m actually facing a similar situation with Nuxt when running on SSR. In Nuxt there’s a certain function (asyncData) that’s called on both server side and client side to initialize the data.
When running on server side, it’s bound to error because there’s no access to the localStorage. I know I can ditch the Parse SDK and use REST API instead, it’ll be too much of wrapping codes to do.
Or, I could separate the codes depending if it’s running on server or client, but it’s going to duplicated everywhere.
I tried to set the RESTController to read the sessionToken from cookies.
ajax: (...args) => RESTController.ajax.apply(null, args),
const token = getSessionToken(req.headers.cookie)
return injectSessionToken(token, RESTController).apply(null, args);
I was too naive, Parse SDK is a singleton, under race conditions, user A could access user B’s data.
My takeaway was that Parse is not a good choice for SSR, especially the data you’re trying to access is restricted. I guess I’m going to stick with SPA for now.