0

I developed my first Go app and decided to deploy it to Google Cloud (App Engine). It was running perfectly fine locally but I run into a few issues during the deployment (I'm using Cloud SDK).

I eventually got to the point where I was able to successfully deploy it to GCP but I keep getting

500 error

when trying to access the app.

I cannot do any local development either because every time I run go run main.go, go get -u, go build I'm getting:

go: finding module for package github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql
go: found github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql in github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20200513164142-a9864b03c326
go: github.com/GoogleCloudPlatform/cloudsql-proxy@v0.0.0-20200513164142-a9864b03c326 requires
        cloud.google.com/go@v0.56.0 requires
        cloud.google.com/go/bigquery@v1.4.0 requires
        cloud.google.com/go@v0.52.0 requires
        cloud.google.com/go/bigquery@v1.0.1/go.mod: verifying module: cloud.google.com/go/bigquery@v1.0.1/go.mod: cannot authenticate record data in server response

My go.mod file looks like this:

module swanson

go 1.14

require github.com/gorilla/mux v1.7.4

and this is the structure of my app (main.go, models, and router are 3 different packages):

structure

I'm new to Go development and never deployed a Go app to GCP so feeling quite lost, any help would be much appreciated.

Jacas
  • 331
  • 6
  • 11

1 Answers1

0

I have tried deploying a go application in app engine and also running it locally and both worked.

I used this application in github, which you can clone with the command:

git clone https://github.com/GoogleCloudPlatform/golang-samples

The command I have used for running the application locally is :

go run helloworld.go

And the command returned the following message:

2020/05/22 11:34:16 Defaulting to port 8080
2020/05/22 11:34:16 Listening on port 8080

Then in the Cloud Shell I have opened the web preview in the port 8080 and it was working as expected.

For more information about the deployment, you can check this documentation.

iker lasaga
  • 330
  • 1
  • 3
  • 18