mclay / azure-pipeline-allure-report

Other
5 stars 4 forks source link

Getting referrer: req.getHeader("referer") ?? undefined error #3

Open asyash26 opened 1 year ago

asyash26 commented 1 year ago

I am getting an error while running the pipeline. Do you have any idea what is wrong and how this can be fixed?

[error]Unhandled: Unexpected token ?

[error]/__w/_tasks/PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973/1.0.21/node_modules/jsdom/lib/api.js:139

      referrer: req.getHeader("referer") ?? undefined
                                          ^

SyntaxError: Unexpected token ? at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/__w/_tasks/PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973/1.0.21/dist/index.js:15:17) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) Finishing: Publish Allure Report

fullmetalcringina commented 1 year ago

Try to change in https://github.com/mclay/azure-pipeline-allure-report/blob/main/PublishAllureReport/package.json "jsdom": "^21.1.0" to an older version (<=16.2.1) or update your node.js (https://node.green/#ES2021-features-Logical-Assignment-----basic-support)

TimvanderMeijs1 commented 1 year ago

encountered a similar issue with the task persistently referring to the node10 folder within the externals directory on my EC2 agent. This behavior is associated with tasks relying on an outdated version of Azure DevOps, and Node.js 10 lacks the proper support for jsdom, for evident reasons. After some investigation, I've identified a workaround that, while not ideal, successfully resolved the issue.

The workaround entails obtaining a more recent version of Node.js (>14), extracting its contents, and subsequently renaming the resulting folder to node10. This adjustment appears to mitigate the compatibility issue with the task.

For additional details and context, please refer to the linked information.

krawczyktt commented 11 months ago

encountered a similar issue with the task persistently referring to the node10 folder within the externals directory on my EC2 agent. This behavior is associated with tasks relying on an outdated version of Azure DevOps, and Node.js 10 lacks the proper support for jsdom, for evident reasons. After some investigation, I've identified a workaround that, while not ideal, successfully resolved the issue.

The workaround entails obtaining a more recent version of Node.js (>14), extracting its contents, and subsequently renaming the resulting folder to node10. This adjustment appears to mitigate the compatibility issue with the task.

For additional details and context, please refer to the linked information. For me your solution worked properly. But like you said it's doesn't look good . Always better to upgrade ADO.

TimvanderMeijs1 commented 11 months ago

Yes, a better workaround would be to update your Azure Pipeline Agent to the latest Pipeline Agent that Azure DevOps ships.