faas: Web UI shows undefined as response body

Steps to Reproduce

Run the Web UI as decribed in Deployment guide for Docker Swarm

$ git clone https://github.com/openfaas/faas && \
  cd faas && \
  git checkout 0.7.0 && \
  ./deploy_stack.sh

Create Node.js function:

faas-cli new ui-bug --lang node

handler.js

"use strict"

module.exports = (context, callback) => {
    callback(false, '[\n  "foo" => "foo"\n]');
}
faas-cli build -f ui-bug.yml
faas-cli deploy -f ui-bug.yml

Open http://localhost:8080/ui/ and invoke a Text request for ui-bug function.

Note: Chrome Dev Tools shows response with response header Content-Type:text/plain and body

[
  "foo" => "foo"
]

Expected Behaviour

Web UI should show response body:

[
  "foo" => "foo"
]

Current Behaviour

Web UI shows response body:

undefined
undefined

Your Environment

  • Docker version 17.12.0-ce
  • I’m using Docker Swarm
  • Operating System: Linux Mint 18 (64bit)
  • Browser: Chromium Version 63.0.3239.132

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@alexellis @kenfdev Thank you very much 👍

Great input from #TeamServerless there - thank you.

@kenfdev or @jrevillas please could you co-ordinate and:

  • Raise an issue to migrate to 1.6.6 (ideally with the same CDN if available)
  • Raise a PR changing the success/error promise to then/catch

Whilst working on this - test out the store / manual deployment and auto-refresh behavior to see there is any regression or whether there are other concerns about moving up in version.

@jrevillas I had some time so did a quick research.

As from this comment (Alex, you’re fast) https://github.com/angular/angular.js/issues/15897#issuecomment-367672775

It seems like upgrading AngularJS to 1.6.6 or greater would solve this problem. I did a quick check and confirmed that it is working as below:

image

Some considerations are that there are breaking changes to the AngularJS API between 1.5 to 1.6 as mentioned here.

For example

$http’s deprecated custom callback methods - success() and error() - have been removed. You can use the standard then()/catch() promise methods instead, but note that the method signatures and return values are different.

The UI is using the success method so we’ll have to change it.

I think we should perhaps add another issue about migrating to 1.6 and consider what we need to change.