spinframework / spinframework/spin

can't build go-api with mongoDB

Open
#1,656 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

Do any of the following links help with your problem?

NO
Application Prerequisites
Troubleshooting - Rust
Cloud FAQ

If you still see a bug or problem, please let us know:

So I have created a simple go-API which is using MongoDB as a database. So I thought let's use spin to deploy it but while building it give me an error which is related to MongoDB.

spin build
Building component go-api with `tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go`
Working directory: "/workspaces/GO-MongoDB-API/"
# go.mongodb.org/mongo-driver/x/mongo/driver/dns
../../go/pkg/mod/go.mongodb.org/mongo-driver@v1.10.3/x/mongo/driver/dns/dns.go:20:57: undefined: net.SRV
../../go/pkg/mod/go.mongodb.org/mongo-driver@v1.10.3/x/mongo/driver/dns/dns.go:25:37: undefined: net.LookupSRV
../../go/pkg/mod/go.mongodb.org/mongo-driver@v1.10.3/x/mongo/driver/dns/dns.go:25:52: undefined: net.LookupTXT
Error: Build command for component go-api failed with status Exited(1)

SO it is possible the spin is not supporting MongoDB that's why it is giving this error.

  • Spin version (spin 1.4.1 (e0bd911 2023-07-12))
  • Installed plugin versions (cloud 0.1.1 [installed] js2wasm 0.5.0 [installed] py2wasm 0.3.0 [installed])

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with main.go and reproduce spin build using the reported Spin version, then inspect the mongo-driver dns package and the undefined net.SRV, net.LookupSRV, and net.LookupTXT symbols. Done means confirming whether this Go/MongoDB dependency combination can build for WASI and recording either a working build or a clear supported limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mongodb, wasm
Domain
backend, build-system, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.