I am trying to install from source the kubo ipfs. everything seems great except the api. I can connect to the repo, i can access the gateway as there are ahndlers you can set for the gate way. i can even access the webui but of course it fails to connect to the api. I can publish a file and get a file. The node indicates it is online and i have tried everything I can to get the api name space and api to run or respond. would be real nice if there was a ApiOption that can just be set so this is guaranteed to work and you have control over it.
as the Gateway and webui work great if I had control/access to the api I image it would be working too.
opts := []corehttp.ServeOption{
corehttp.WebUIOption, // Enable the Web UI
corehttp.GatewayOption("/"), // Enable the Gateway
}
go func() {
// Start API server
apiHandler, err := corehttp.MakeHandler(node, ln, opts…)
if err != nil {
log.Fatalf(“Failed to create API handler: %v”, err)
}
/* apiHandler, err := corehttp.MakeHandler(node, nil, corehttp.RoutingOption())
if err != nil {
log.Fatalf(“Failed to create API handler: %v”, err)
} */
// Create a new ServeMux (router)
http.Handle("/api/v0", apiHandler)
//http.Handle("/webui", apiHandler)
fmt.Printf("Starting API server on %s\n", apiAddr)
if err := http.Serve(ln, apiHandler); err != nil && err != http.ErrServerClosed {
log.Fatalf("API server failed: %v", err)
}
}()
this is what I have currently.
some of my debug info I have print out is
Node is online
Starting Gateway server on :8080
Starting API server on :5001
I can store a file get a cid and the get the file back using the cid and gateway.
I have everything open and allowed for CORS from any origin * one set of headers for the gateway and another set for the api sections of the config file.
I have set logging ot debug level and see no errors, info, or warnings regarding the api just nothing. When i do a curl or browser to the http://127.0.0.1/api/v0 I just get namespace not found and no log entries are generated.
// Open the repository
repo, err := fsrepo.Open(repoPath)
if err != nil {
log.Fatalf("Failed to open IPFS repo: %v", err)
}
// Create a new IPFS node
node, err = core.NewNode(context.Background(), &core.BuildCfg{
Repo: repo,
Online: true,
Host: libp2p.DefaultHostOption,
})
if err != nil {
log.Fatalf("Failed to create IPFS node: %v", err)
}
node.Repo.SetConfigKey("Daemon", true)
cg, _ := node.Repo.Config()
fmt.Printf("Repo Config %v \n", cg)
// Create a CoreAPI instance
// Enable verbose logging
log2.SetLogLevel("coreapi", "DEBUG")
log2.SetLogLevel("core", "DEBUG")
log2.SetLogLevel("http", "DEBUG")
api, err := coreapi.NewCoreAPI(node)
if err != nil {
log.Fatalf("Failed to create CoreAPI instance: %v", err)
}
Boot() //connect to bootstrap nodes
api.Swarm()
Any ideas as to why the api and only the api is failing to start or work would greatly be appreciated,```