Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
Electron Amplify AppSync "Realtime disabled when in a server-side environment"

I'm using amplify appsync in my electron app and all works except for the realtime events which means my app doesn't get signalled when the data changes in the cloud.

I know this is because it's running in Node which is what amplify is looking for (JS.browserOrNode) however I don't know how to fix it. Can someone advise me how I can get the realtime updates? When I query it just gets the local data unless I Datastore.stop() and Datastore.start() but surely there's a better way?

Thank you in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Thanks to the amplify team on discord for this one, in amplify-js the logic for the browser vs node check is:

const browserOrNode = () => {
    const isBrowser =
        typeof window !== 'undefined' && typeof window.document !== 'undefined';
    const isNode =
        typeof process !== 'undefined' &&
        process.versions != null &&
        process.versions.node != null;

    return {
        isBrowser,
        isNode,
    };
};

The Datastore logic determines whether it's going to spit that warning or start the subscriptions:

if (isNode) {
    logger.warn(
        'Realtime disabled when in a server-side environment'
    );
} else {
    //#region GraphQL Subscriptions
    [
        // const ctlObservable: Observable<CONTROL_MSG>
        ctlSubsObservable,
        // const dataObservable: Observable<[TransformerMutationType, SchemaModel, Readonly<{
        // id: string;
        // } & Record<string, any>>]>
        dataSubsObservable,
    ] = this.subscriptionsProcessor.start();
}

But because Electron runs the app in a Node.js environment it's why DataStore is disabling realtime.

You can stop this by forcing isNode to be false and then realtime works with electron :)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda