octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
6.97k stars 1.02k forks source link

[BUG]: Error when using Octokit in an Azure DevOps extension #2553

Closed rogerex007 closed 1 year ago

rogerex007 commented 1 year ago

What happened?

I'm creating an extension for Azure DevOps using TypeScript. When I build the project and package the extension, it doesn't show any errors. However, when I deploy the task in a pipeline, it generates the following error:

image

NOTE: When I perform tests and local executions of my code, everything works fine. The issue arises when I try to run it from Azure DevOps using a pipeline. It's important to mention that the Node.js and npm versions used by the Azure DevOps agent are the same as those on my local machine.

Versions

Octokit@3.1.0 Node@16.20.2 npm@8.19.4

Relevant log output

2023-09-29T17:25:52.5275572Z ##[section]Starting: Version NX_BASE
2023-09-29T17:25:52.5281466Z ==============================================================================
2023-09-29T17:25:52.5282178Z Task         : Versioner
2023-09-29T17:25:52.5282651Z Description  : Generator of a tag version based on conventional commits
2023-09-29T17:25:52.5282969Z Version      : 1.0.4
2023-09-29T17:25:52.5283543Z Author       : DevOps Team
2023-09-29T17:25:52.5283890Z Help         : 
2023-09-29T17:25:52.5284124Z ==============================================================================
2023-09-29T17:25:53.0506499Z ##[error]Unhandled: Unexpected token {
2023-09-29T17:25:53.0529828Z ##[error]/home/vsts/work/_tasks/versioner_97ecd1d8-08b8-4aa7-995f-c7175bdbeca1/1.0.4/node_modules/@octokit/core/dist-node/index.js:37
  static {
         ^

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.<anonymous> (/home/vsts/work/_tasks/versioner_97ecd1d8-08b8-4aa7-995f-c7175bdbeca1/1.0.4/client/github.js:34:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2023-09-29T17:25:53.0548874Z ##[section]Finishing: Version NX_BASE

Code of Conduct

github-actions[bot] commented 1 year ago

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

wolfy1339 commented 1 year ago

We don't support NodeJS v16 anymore. Please try again with NodeJS v18 or later

rogerex007 commented 1 year ago

I have the same error image

wolfy1339 commented 1 year ago

That is valid syntax, it's Static class fields and according to the MDN article, it has been supported since NodeJS v6.

I'm not sure why Azure DevOps is complaining

Unfortunately there isn't anything actionable on our end as this isn't an issue with Octokit, as tests work both locally and on GitHub Actions