We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
offerings.go
package offerings import ( "context" "ftl/builtin" "ftl/rates" "github.com/TBD54566975/ftl/go-runtime/ftl" ) type ApiError struct { Error string `json:"error"` } //ftl:export //ftl:ingress GET /offerings func GetOfferings(ctx context.Context, req builtin.HttpRequest[builtin.Empty]) (builtin.HttpResponse[builtin.Empty, ApiError], error) { log := ftl.LoggerFromContext(ctx) rate, err := ftl.Call(ctx, rates.GetRates, rates.RateRequest{}) log.Infof("RATE! %v", rate) if err != nil { return builtin.HttpResponse[builtin.Empty, ApiError]{ Status: 500, Error: ftl.Some(ApiError{Error: "wottf"}), }, nil } return builtin.HttpResponse[builtin.Empty, ApiError]{ Status: 200, Body: ftl.Some(builtin.Empty{}), }, nil }
rates.go
package rates import ( "context" ) type RateRequest struct{} type RateResponse struct { Rates string `json:"rates"` } //ftl:export func GetRates(ctx context.Context, req RateRequest) (RateResponse, error) { return RateResponse{ Rates: `"hi2u"`, }, nil }
❯ curl -v 'http://localhost:8892/ingress/offerings' * Trying [::1]:8892... * connect to ::1 port 8892 failed: Connection refused * Trying 127.0.0.1:8892... * Connected to localhost (127.0.0.1) port 8892 > GET /ingress/offerings HTTP/1.1 > Host: localhost:8892 > User-Agent: curl/8.4.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Type: application/json; charset=utf-8 < Date: Mon, 08 Apr 2024 04:43:58 GMT < Content-Length: 17 < * Connection #0 to host localhost left intact {"error":"wottf"}
terminal running ftl dev:
ftl dev
error:controller0: failed to record call: ERROR: invalid input syntax for type json (SQLSTATE 22P02) info:ledger: RATE! {}
The text was updated successfully, but these errors were encountered:
ftl.Call
Found what is happening. The response is:
{"rates":""hi2u""}
Sorry, something went wrong.
fix: correctly encode strings
755b5f1
Fixes #1199
fix: correctly encode strings (#1203)
c1cb72d
alecthomas
Successfully merging a pull request may close this issue.
Repro
offerings.go
rates.go
terminal running
ftl dev
:Other Thoughts
The text was updated successfully, but these errors were encountered: