openfaas-incubator / powershell-http-template

OpenFaaS HTTP template for PowerShell
MIT License
7 stars 4 forks source link

Exception calling "Start" with "0" argument(s): "Address already in use" #4

Open ziggekatten opened 5 years ago

ziggekatten commented 5 years ago

I have a strange behavior.

Running an OpenFaaS installation, where things works as they shoulh (normally) and we have some functions running on node10-express template as base.

Now, we tried the powershell-http-template.

Procedure:

faas-cli template store pull powershell-http-template faas-cli new --lang powershell-http psdemo faas-cli up -f psdemo.yml

It all deploys, running as a service(Docker Swarm), but invoking gives the error:

Exception calling "Start" with "0" argument(s): "Address already in use" At /server.ps1:20 char:1

  • $listener.Start()
  • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  • FullyQualifiedErrorId : HttpListenerException

'Exception calling "GetContext" with "0" argument(s): "Cannot access a disposed object. Object name: 'System.Net.HttpListener'." At /server.ps1:25 char:5

  • $context = $listener.GetContext()
  • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  • FullyQualifiedErrorId : ObjectDisposedException

Exception calling ".ctor" with "2" argument(s): "Value cannot be null. Parameter name: stream" At /server.ps1:32 char:5

  • $reader = [System.IO.StreamReader]::new($reqStream, $reqEncoding)
  • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression. At /server.ps1:35 char:5

  • $fnContext.Body = $reader.ReadToEnd()
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : InvokeMethodOnNull

The property 'StatusCode' cannot be found on this object. Verify that the property exists and can be set. At /server.ps1:53 char:85

  • ... de = $(If ($fnResponse.Status) {$fnResponse.Status} Else {500}) #defa ...
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : PropertyNotFound

The property 'Headers' cannot be found on this object. Verify that the property exists and can be set. At /server.ps1:56 char:5

  • $response.Headers = $fnResponse.Headers
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : PropertyNotFound

The property 'ContentLength64' cannot be found on this object. Verify that the property exists and can be set. At /server.ps1:57 char:5

  • $response.ContentLength64 = $Content.Length
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression. At /server.ps1:58 char:5

  • $response.OutputStream.Write($Content, 0, $Content.Length)
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression. At /server.ps1:59 char:5

  • $response.Close()
  • CategoryInfo : InvalidOperation: (:) [], RuntimeException
  • FullyQualifiedErrorId : InvokeMethodOnNull

nodejs and go that we runs woks perfectly.

MnrGreg commented 5 years ago

@ziggekatten see fixes in #5