Azure Communication Services javascript sdk on SSR

Hyounwoo Sung 41 Reputation points
2020-10-31T11:28:29.21+00:00

Hi I've encounter below exception where my project is SSR

ReferenceError: window is not defined
at Object.<anonymous> (/Users/hyounoo/Github/CloudHospital.Front/node_modules/@azure/communication-calling/sdk.bundle.js:4:275)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.@azure/communication-calling (/Users/hyounoo/Github/CloudHospital.Front/external "@azure/communication-calling":1:1)
at webpack_require (/Users/hyounoo/Github/CloudHospital.Front/build/webpack:/webpack/bootstrap:690:1)
at fn (/Users/hyounoo/Github/CloudHospital.Front/build/webpack:/webpack/bootstrap:59:1)

first, I tried to solve this with loadable but it didn't work.

Only way I could get around with this error is removing all the references related to @azure/communication-calling sdk and start the project, than add them all back.
I had to remove the references even my redux stores.

Is this intended or will be fixed soon?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
892 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. kaniartur 76 Reputation points
    2020-11-02T18:50:16.643+00:00

    Hi @Hyounwoo Sung - can you please open an issue on GitHub - https://github.com/Azure/Communication/issues
    Please provide more details - what's the environment you're running in, which bundles/loaders are you using, a description/repro steps that would allow us to repro would be great. Based on the description you attached - are you running in browser? Lack of 'window' suggests potential issue with accessing global scope which shouldn't be an issue if you run in browser.

    Thank you

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.