AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

[ReferenceError] "ReferenceError: window is not defined" on [email protected]

Open swatDong opened this issue 3 years ago • 1 comments

Target Platforms

NodeJS

SDK Version

2.11.0

Application Name

Node console app

Problem Description

My project is a node backend app using adaptivecards to parse/render/verify card content on server side. It was using [email protected] and everything worked well. After switching to the latest [email protected], it throws ReferenceError: window is not defined on require("adaptivecards").

ReferenceError: window is not defined at Object. (...\node_modules\adaptivecards\lib\utils.js:149:26) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (...\node_modules\adaptivecards\lib\adaptivecards.js:22:14) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

Screenshots

image

Card JSON

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.4",
  "body": [
  ]
}

Sample Code Language

javascript

Sample Code

const { AdaptiveCard } = require("adaptivecards"); // error occurs at this line

const card = require("./card.json"); const ac = new AdaptiveCard(); ac.parse(card);

swatDong avatar Sep 17 '22 11:09 swatDong

Same for me when I try to run this sample repo code.

Going back to 2.10.0 fixed my issue.

https://github.com/OfficeDev/TeamsFx-Samples/tree/v1.0.0/bot-sso

node: 16.17.0 SDK: 2.11.0

dupontbenoit avatar Sep 18 '22 13:09 dupontbenoit

Hey @swatDong - this has been fixed in 2.11.1! Please let us know if you encounter any further difficulties.

paulcam206 avatar Sep 26 '22 20:09 paulcam206