apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.54k stars 1.17k forks source link

Swift action parsing doesn't tolerate special characters #362

Closed jberstler closed 7 years ago

jberstler commented 8 years ago

For example, if I try to run an action with the following code:

//  Copyright © 2016 Dirk Beanberger. All rights reserved.
func main(args: [String:Any]) -> [String:Any] {
  return ["message": "This should just work..."]
}

I always get an error of the action did not produce a valid JSON response

However, if I simply remove the © everything works as expected.

rabbah commented 8 years ago

This may not be specific to Swift - see #252 (if you do resolve the Swift-specific issue, you will run into 252 next).

jberstler commented 8 years ago

@rabbah That seems pretty likely. The Swift action file handling already is explicit about using UTF-8. I suggest keeping this open to verify that #252 actually fixes this specific symptom.

rabbah commented 8 years ago

Your symptom is different - the action did not produce a valid JSON response suggests there was a failure executing the action (I would check the proxy for example to confirm it returned the correct value). The defect from 252 will manifest differently (the activation record will show a different result value).

rabbah commented 7 years ago

@bjustin-ibm @paulcastro is this still valid?

jberstler commented 7 years ago

@rabbah It is still valid. On the Swift 3 runtime, I get the following error, but only with the copyright character present:

{
  "error": "The action failed to generate or locate a binary. See logs for details."
}
paulcastro commented 7 years ago

@bjustin-ibm that message indicates a compilation error.

stevenatkin commented 7 years ago

I believe that this is tied to #252. We really need to get someone to take a look at this. I don't think that this should be too hard to fix. I think the problem is that they are running OpenWhisk in the wrong codepage they should be running in UTF-8. My guess is that they are probably defaulting to ISO8859-1 (Latin 1) when they should be using Unicode.

rabbah commented 7 years ago

The fix for #252 is necessary but not sufficient to fix swift (and python) actions. The proxy needs to handle utf-8 encoding, where it currently does not; pr #1757 includes the required invoker side fix.

rabbah commented 7 years ago

proposed patch https://github.com/openwhisk/openwhisk/commit/4f2c1043abf754591ab3d7a35947b41ff2000d4c.

rabbah commented 7 years ago

Fix merged via #1757. Leaving open however to investigate Travis failure via CLI tests of new unicode python/swift actions.

cclauss commented 7 years ago

Is this still in progress?

rabbah commented 7 years ago

The Travis issue might still exist. I have not investigated.

rabbah commented 7 years ago

Looks like we have a recent regression in the swift actions.

rabbah commented 7 years ago

tests enabled in pr #2070.