Skip to content

Illegal query: Invalid input ' ', expected '+', '=', query-char, 'EOI', '&' or pct-encoded  #5043

Closed
@jonee

Description

@jonee

Environment details:

  • IBM Cloud Functions
  • Golang or Docker / Native runtime
  • Also reproducible for nodejs

Steps to reproduce the issue:

  1. Create the action with the code below (ibmcloud fn action update helloGo main.go --kind go:1.15 --web true)
  2. Retrieve the web action and invoke with a post
    ibmcloud fn action get helloGo --url <- returns your url

curl -X POST -d '{"name":"sfdsfs4 "}' https://us-south.functions.appdomain.cloud/api/v1/xxx/helloGo.json

Provide the expected results and outputs:

Expects the program to not error out and work as intended

Provide the actual results and outputs:

{"code":"6683a4187e392c69625e2dbafba217ee","error":"Illegal query: Invalid input ' ', expected '+', '=', query-char, 'EOI', '&' or pct-encoded (line 1, column 17): {\"name\":\"sfdsfs4 \"}\n                ^"}

Additional information you deem important:

  • issue happens 100% of the time and should be easy to reproduce
  • It errors out when a post parameter has a space character. If a parameter has the +, it becomes a space.
  • Also, for native / docker it does not reuse variables outside of the main function (as compared to Golang runtime). This is usually used to reuse db connection (separate bug report)

Code for golang runtime
save as main.go
ibmcloud fn action update helloGo main.go --kind go:1.15 --web true
ibmcloud fn action get helloGo --url # returns your url
curl -X POST -d '{"name":"sfdsfs4 "}' https://us-south.functions.appdomain.cloud/api/v1/xxx/helloGo.json
ibmcloud wsk activation logs --last # returns the logs

package main

import (
    "log"
    "os"
    "time"
)
var t0 time.Time

func Main(params map[string]interface{}) map[string]interface{} {
    log.Println("params")
    log.Println(params)

    log.Println("os.Args")
    log.Println(os.Args)

    if t0.IsZero() {
		t0 = time.Now()
		log.Println("new t0")
	} else {
		log.Println("re used t0")
    }

    res := make(map[string]interface{})
    res["body"] = "Hello!"
    return res
}

Code for native / docker runtime
save as main.go
GOOS=linux GOARCH=amd64 go build -o exec
zip exec.zip exec
ibmcloud wsk action update helloGo --native exec.zip
ibmcloud fn action get helloGo --url <- returns your url
curl -X POST -d '{"name":"sfdsfs4 "}' https://us-south.functions.appdomain.cloud/api/v1//helloGo.json
ibmcloud wsk activation logs --last # returns the logs

package main

import (
    "fmt"
    "log"
    "os"
    "time"
    "encoding/json"
)
var t0 time.Time

func main() {
    log.Println("os.Args")
    log.Println(os.Args)

    if t0.IsZero() {
		t0 = time.Now()
		log.Println("new t0")
	} else {
		log.Println("re used t0")
    }

    msg := map[string]string{"body": ("Hello!")}
    res, _ := json.Marshal(msg)
    fmt.Println(string(res))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions