Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: (e || "").replace is not a function #76

Closed
asbjornu opened this issue Mar 25, 2020 · 15 comments
Closed

TypeError: (e || "").replace is not a function #76

asbjornu opened this issue Mar 25, 2020 · 15 comments

Comments

@asbjornu
Copy link
Member

asbjornu commented Mar 25, 2020

I just got the following exception while running gittools/actions/gitversion/[email protected]:

(node:2814) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function

Any idea what might cause this?

@arturcic
Copy link
Member

I saw that error on the GitTools/actions itself when building a [dependabot] PR, but I re-run the build and it was fine

@asbjornu
Copy link
Member Author

Yes, re-running the build fixes the problem, but I've seen it 3 times now. Any ideas what might cause it?

@arturcic
Copy link
Member

honestly no, but we need to have a look

@asbjornu
Copy link
Member Author

Is it possible to get some sort of source maps available so we get sensible line numbers and stack traces? bundle.js:5:943 is pretty much worthless information, unfortunately.

@arturcic
Copy link
Member

It should be possible, I'll check it how

@riverar
Copy link

riverar commented Apr 4, 2020

Seeing this all the time in 5.1.x. In 5.2.x, I get a bit more clarity (may be unrelated).

Don't think I'm doing any particularly complex.

- name: Install GitVersion
  uses: gittools/[email protected]
  with:
    versionSpec: 5.1.x
    includePrerelease: false

- name: Use GitVersion
  id: gitversion
  uses: gittools/actions/gitversion/[email protected]
  
2020-04-04T07:10:34.1537866Z Command: dotnet-gitversion d:/a/EarTrumpet/EarTrumpet /output json 
2020-04-04T07:10:34.1593373Z [command]C:\hostedtoolcache\windows\GitVersion.Tool\5.2.4\x64\dotnet-gitversion.exe d:/a/EarTrumpet/EarTrumpet /output json ""
2020-04-04T07:10:35.0865109Z Unhandled exception. GitVersion.Exceptions.WarningException: Value '' cannot be parsed as output type, please use 'json' or 'buildserver'
2020-04-04T07:10:35.0865624Z    at GitVersion.ArgumentParser.ParseArguments(String[] commandLineArguments) in D:\a\GitVersion\GitVersion\src\GitVersionExe\ArgumentParser.cs:line 320
2020-04-04T07:10:35.0865927Z    at GitVersion.Program.<>c__DisplayClass1_0.<CreateHostBuilder>b__2(IServiceProvider sp) in D:\a\GitVersion\GitVersion\src\GitVersionExe\Program.cs:line 28
2020-04-04T07:10:35.0866238Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0866511Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0866787Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0867066Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0867325Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0867597Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0867846Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0868143Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0868407Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0868659Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0868903Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2020-04-04T07:10:35.0869152Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
2020-04-04T07:10:35.0869401Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
2020-04-04T07:10:35.0871297Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
2020-04-04T07:10:35.0871989Z    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
2020-04-04T07:10:35.0872422Z    at GitVersion.GitVersionCoreModule.<>c.<RegisterTypes>b__0_0(IServiceProvider sp) in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitVersionCoreModule.cs:line 37
2020-04-04T07:10:35.0872700Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0872959Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0873241Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0873511Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0874010Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0874713Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0875167Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0875478Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0875785Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0876058Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0876302Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0876565Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0876848Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0878615Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0879104Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0879421Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0879715Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0880022Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
2020-04-04T07:10:35.0880811Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
2020-04-04T07:10:35.0881199Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2020-04-04T07:10:35.0881486Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2020-04-04T07:10:35.0881776Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
2020-04-04T07:10:35.0882059Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
2020-04-04T07:10:35.0882341Z    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
2020-04-04T07:10:35.0882610Z    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
2020-04-04T07:10:35.0882873Z    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
2020-04-04T07:10:35.0883156Z    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2020-04-04T07:10:35.0883417Z    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2020-04-04T07:10:35.0883691Z    at GitVersion.Program.Main(String[] args) in D:\a\GitVersion\GitVersion\src\GitVersionExe\Program.cs:line 14
2020-04-04T07:10:35.0883904Z    at GitVersion.Program.<Main>(String[] args)
2020-04-04T07:10:35.1184761Z (node:4396) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function
2020-04-04T07:10:35.1200895Z     at d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:5:943
2020-04-04T07:10:35.1208442Z     at s.toString (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:5:1005)
2020-04-04T07:10:35.1211544Z     at o (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:5:372)
2020-04-04T07:10:35.1213576Z     at Object.t.issue (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:5:432)
2020-04-04T07:10:35.1241844Z     at c (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:9:741)
2020-04-04T07:10:35.1244898Z     at Object.t.setFailed (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:9:1482)
2020-04-04T07:10:35.1245324Z     at h.setFailed (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:304:1902)
2020-04-04T07:10:35.1245902Z     at Object.<anonymous> (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:332:1542)
2020-04-04T07:10:35.1246223Z     at Generator.throw (<anonymous>)
2020-04-04T07:10:35.1246472Z     at a (d:\a\_actions\gittools\actions\v0.9\dist\github\gitversion\execute\bundle.js:332:221)
2020-04-04T07:10:35.1246924Z (node:4396) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
2020-04-04T07:10:35.1247255Z (node:4396) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2020-04-04T07:10:35.1743675Z Post job cleanup.

@riverar
Copy link

riverar commented Apr 4, 2020

Upgrading to gitversion/[email protected] resolved my particular issue so probably not related after all.

@durutheguru
Copy link

i also began experiencing this issue quite recently. it has been happening consistently. what's weird is it was working fine before and started all of a sudden. i'm currently unable to run my builds.

(node:3423) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function at /home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:943 at s.toString (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:1005) at o (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:372) at Object.t.issue (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:432) at c (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:9:741) at Object.t.setFailed (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:9:1482) at h.setFailed (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:308:1902) at Object.<anonymous> (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:336:1575) at Generator.next (<anonymous>) at s (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:336:170) (node:3423) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:3423) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

any idea what could be wrong? i would be happy to provide more details.

@AndyCW
Copy link

AndyCW commented Apr 15, 2020

I'm seeing this issue also. My config is almost exactly as in the docs:

    - name: Install GitVersion
      uses: gittools/actions/gitversion/[email protected]
      with:
          versionSpec: '5.2.x'
          
    - name: Use gitversion
      id: gitversion # step id used as reference for output values
      uses: gittools/actions/gitversion/[email protected]
      with:
        useConfigFile: true

Error details:

(node:2789) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function
at /home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:943
at s.toString (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:1005)
at o (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:372)
at Object.t.issue (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:5:432)
at c (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:9:741)
at Object.t.setFailed (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:9:1482)
at h.setFailed (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:308:1902)
at Object. (/home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:336:1575)
at Generator.next ()
at /home/runner/work/_actions/gittools/actions/v0.9.2/dist/github/gitversion/execute/bundle.js:336:368
(node:2789) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2789) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@bonesoul
Copy link

the issue randomly appears in my builds too

@arturcic
Copy link
Member

arturcic commented May 6, 2020

@asbjornu in version v0.9.3 I did not compress the files, in case you notice the same issue, can you put here the output?

@asbjornu
Copy link
Member Author

asbjornu commented May 6, 2020

I'll update and report back if the problem reappears, @arturcic! 👍

@AndyCW
Copy link

AndyCW commented May 22, 2020

Moving to v0.9.3 fixed this problem for me.

@arturcic
Copy link
Member

Thanks for the update, closing

shoshins added a commit to shoshins/apple-receipt that referenced this issue Jul 12, 2020
Fixing issues.
1) "Value '' cannot be parsed as output type, please use 'json', 'file' or 'buildserver'"
2) "(node:2664) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function"
According to the link GitTools/actions#76
@w5l
Copy link

w5l commented Sep 25, 2020

Came across this as well, please update the documentation to point to v0.9.3 (or higher, 0.9.4 is out already too). Right now it still says 0.9.2 in all examples and docs. Maybe provide a tag that always points to latest version, and use that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants