Azure / api-management-developer-portal

Developer portal provided by the Azure API Management service.
MIT License
488 stars 318 forks source link

Build-Function script is throwing an error #2157

Open Schuckknight opened 1 year ago

Schuckknight commented 1 year ago

We are using the self hosted version of the portal and running into an error during the Build-Function command. This error also occurs in the latest azure dev portal code, not just our version.

Reproduction Steps: 1) Run the command "npm run build-function" 2) The output will show that an error is occurring due to a missing canvas npm package.

The outputted error is a mistake in my opinion. Canvas is an optional dependency of the jsdom npm package. There are other optional npm package dependencies (for example, bufferutil and utf-8-validate) in the latest azure dev portal code, but these just throw warnings. The error that is thrown due to the optional canvas package is causing our azure pipeline to fail because the build-function command returns a non zero value because of this error.

Relevant output from running command "npm run build-function"

`WARNING in ./node_modules/ws/lib/buffer-util.js 117:23-44 Module not found: Error: Can't resolve 'bufferutil' in '...\node_modules\ws\lib' @ ./node_modules/ws/lib/receiver.js 12:42-66 @ ./node_modules/ws/index.js 7:21-46 @ ./node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js 7:18-31 @ ./node_modules/jsdom/lib/jsdom/browser/Window.js 21:22-83 @ ./node_modules/jsdom/lib/api.js 13:25-61 @ ./node_modules/@paperbits/common/publishing/jsdomHtmlDocumentProvider.ts 4:16-32 @ ./node_modules/@paperbits/common/publishing/index.ts 27:13-51 @ ./node_modules/@paperbits/core/core.publish.module.ts 10:21-60 @ ./examples/publisher/azure-function/publish/index.ts 17:30-76

WARNING in ./node_modules/ws/lib/validation.js 122:24-49 Module not found: Error: Can't resolve 'utf-8-validate' in '...\node_modules\ws\lib' @ ./node_modules/ws/lib/receiver.js 13:43-66 @ ./node_modules/ws/index.js 7:21-46 @ ./node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js 7:18-31 @ ./node_modules/jsdom/lib/jsdom/browser/Window.js 21:22-83 @ ./node_modules/jsdom/lib/api.js 13:25-61 @ ./node_modules/@paperbits/common/publishing/jsdomHtmlDocumentProvider.ts 4:16-32 @ ./node_modules/@paperbits/common/publishing/index.ts 27:13-51 @ ./node_modules/@paperbits/core/core.publish.module.ts 10:21-60 @ ./examples/publisher/azure-function/publish/index.ts 17:30-76

2 warnings have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/jsdom/lib/jsdom/utils.js 154:2-27 Module not found: Error: Can't resolve 'canvas' in '...\node_modules\jsdom\lib\jsdom' resolve 'canvas' in '...\node_modules\jsdom\lib\jsdom' Parsed request is a module using description file: ...\node_modules\jsdom\package.json (relative path: ./lib/jsdom) resolve as module ...\node_modules\jsdom\lib\jsdom\node_modules doesn't exist or is not a directory ...\node_modules\jsdom\lib\node_modules doesn't exist or is not a directory looking for modules in ...\node_modules\jsdom\node_modules single file module using description file: ...\node_modules\jsdom\package.json (relative path: ./node_modules/canvas) no extension ...\node_modules\jsdom\node_modules\canvas doesn't exist .ts ...\node_modules\jsdom\node_modules\canvas.ts doesn't exist .tsx ...\node_modules\jsdom\node_modules\canvas.tsx doesn't exist .js ...\node_modules\jsdom\node_modules\canvas.js doesn't exist .jsx ...\node_modules\jsdom\node_modules\canvas.jsx doesn't exist .html ...\node_modules\jsdom\node_modules\canvas.html doesn't exist .scss ...\node_modules\jsdom\node_modules\canvas.scss doesn't exist ...\node_modules\jsdom\node_modules\canvas doesn't exist ...\node_modules\node_modules doesn't exist or is not a directory looking for modules in ...\node_modules single file module using description file: ...\package.json (relative path: ./node_modules/canvas) no extension ...\node_modules\canvas doesn't exist .ts ...\node_modules\canvas.ts doesn't exist .tsx ...\node_modules\canvas.tsx doesn't exist .js ...\node_modules\canvas.js doesn't exist .jsx ...\node_modules\canvas.jsx doesn't exist .html ...\node_modules\canvas.html doesn't exist .scss ...\node_modules\canvas.scss doesn't exist ...\node_modules\canvas doesn't exist ...\node_modules doesn't exist or is not a directory C:\src\node_modules doesn't exist or is not a directory C:\node_modules doesn't exist or is not a directory @ ./node_modules/jsdom/lib/jsdom/browser/Window.js 8:26-45 @ ./node_modules/jsdom/lib/api.js 13:25-61 @ ./node_modules/@paperbits/common/publishing/jsdomHtmlDocumentProvider.ts 4:16-32 @ ./node_modules/@paperbits/common/publishing/index.ts 27:13-51 @ ./node_modules/@paperbits/core/core.publish.module.ts 10:21-60 @ ./examples/publisher/azure-function/publish/index.ts 17:30-76

webpack 5.76.1 compiled with 1 error and 2 warnings in 79595 ms`

ghost commented 1 year ago

@Schuckknight, thank you for opening this issue. We will triage it within the next few business days.

Schuckknight commented 1 year ago

Is there an ETA on when this could be looked at?