Skip to content
Back

Return TablesDB from REST and Go Function are different, from Go SDK no returning column

  • 0
  • 2
  • Functions
  • Cloud
bluesky
30 Oct, 2025, 10:50

This my Go code for deploy in function:

TypeScript
package handler

import (
    "os"

    "github.com/appwrite/sdk-for-go/appwrite"
    "github.com/appwrite/sdk-for-go/client"
    "github.com/open-runtimes/types-for-go/v4/openruntimes"
)

var (
    appwriteClient client.Client
)

func Main(Context openruntimes.Context) openruntimes.Response {
    appwriteClient = appwrite.NewClient(
        appwrite.WithEndpoint(os.Getenv("APPWRITE_FUNCTION_API_ENDPOINT")),
        appwrite.WithProject(os.Getenv("APPWRITE_FUNCTION_PROJECT_ID")),
        appwrite.WithKey(Context.Req.Headers["x-appwrite-key"]),
    )

    tablesDB := appwrite.NewTablesDB(appwriteClient)

    if Context.Req.Path == "/cek" {
        if Context.Req.Method == "GET" {

            response, err := tablesDB.ListRows("68f8e75900141e1e5ca6", "hargadomain")
            if err != nil {
                Context.Error("Gagal ngambil row: ", err)
                return Context.Res.Send(err.Error(), Context.Res.WithStatusCode(500))
            }

            return Context.Res.Json(response)

        } else {
            return Context.Res.Send("Metode tidak diizinkan.", Context.Res.WithStatusCode(405))
        }
    }

    return Context.Res.Send("Endpoint tidak ditemukan.", Context.Res.WithStatusCode(404))
}

Compare with this rest: https://sgp.cloud.appwrite.io/v1/tablesdb/68f8e75900141e1e5ca6/tables/hargadomain/rows?project=69031557003caa33521a

This rest is return all column (pic 1), but for go code it's not return the column, any wrong with my code?

TL;DR
The Go function and REST service are returning different TableDB structures. The REST service is correct while the Go function is incorrect. The issue will be double-checked tomorrow due to the user being busy.
30 Oct, 2025, 11:24

Isn't the Go correct but the Rest incorrect?

30 Oct, 2025, 11:27

Rest is correct,

I made all the data can see by anyone on that tables.

1 Nov, 2025, 21:42

Sorry for the late response. Will double check this tomorrow, I have been very busy recently 😒 πŸ™

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more