appengine icon indicating copy to clipboard operation
appengine copied to clipboard

aetest: Failed to build Go application

Open andwun opened this issue 6 years ago • 5 comments

Looks like with google.golang.org/appengine v1.6.5 the aetest package is logging build errors when creating a context in a test:

go test -v -race ./...
=== RUN   TestWorks
INFO     2019-10-18 12:44:00,110 devappserver2.py:278] Skipping SDK update check.
WARNING  2019-10-18 12:44:00,110 devappserver2.py:294] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
WARNING  2019-10-18 12:44:00,156 simple_search_stub.py:1196] Could not read search indexes from /var/folders/lc/lj_w1vkd55s597w1gxhwp46h0000gp/T/appengine.testapp.anwu/search_indexes
INFO     2019-10-18 12:44:00,157 api_server.py:275] Starting API server at: http://localhost:59268
INFO     2019-10-18 12:44:00,159 dispatcher.py:256] Starting module "default" running at: http://localhost:59269
INFO     2019-10-18 12:44:00,160 admin_server.py:150] Starting admin server at: http://localhost:59270
INFO     2019-10-18 12:44:01,163 stub_util.py:357] Applying all pending transactions and saving the datastore
INFO     2019-10-18 12:44:01,163 stub_util.py:360] Saving search indexes
ERROR    2019-10-18 12:44:01,181 instance_factory.py:243] Failed to build Go application: (Executed command: go build -o /var/folders/lc/lj_w1vkd55s597w1gxhwp46h0000gp/T/tmpr8dnB8appengine-go-bin/_ah_exe .)


go: cannot find main module; see 'go help modules'

--- PASS: TestWorks (1.70s)
PASS
ok  	github.com/andwun/aetestrepro	2.721s

Though tests seem to run through and everything else seems to work, these errors can be quite confusing.

Small repro project: https://gist.github.com/andwun/d6c66d023725e18dc60f21ec58bdce93

Go versions tested: 1.13.1 1.11.13

Google Cloud SDK 267.0.0

andwun avatar Oct 18 '19 12:10 andwun

I'm not able to reproduce this with v1.6.5 and gcloud v266. Would you mind running gcloud version to check which version of devappserver2 you have?

roffjulie avatar Oct 21 '19 16:10 roffjulie

Go 1.13 does not support google.golang.org/appengine.

It should work with Go 1.11 -- I second @juliehockett's recommendation to update gcloud. Your dev_appserver.py is probably out of date.

sbuss avatar Oct 21 '19 16:10 sbuss

gcloud already seems to be up to date:

$ gcloud components update All components are up to date.

$ gcloud version Google Cloud SDK 267.0.0 app-engine-go app-engine-python 1.9.86 beta 2019.05.17 bq 2.0.49 cloud-datastore-emulator 2.1.0 core 2019.10.15 gsutil 4.44

I've added a Dockerfile to the repro at [1] and extended the Makefile. This comes very close to what we do in our CI builds minus dependencies unnecessary for the repro and should help reproduce the issue:

  1. Download ZIP from [1]
  2. Unpack ZIP
  3. cd /path/to/unpackedzipcontents/
  4. make dockerbuild
  5. make dockergcloudversion
  6. make dockerrun

[1] https://gist.github.com/andwun/d6c66d023725e18dc60f21ec58bdce93

andwun avatar Oct 22 '19 10:10 andwun

I have the same problem when I use appengine v2 package. Here is how to reproduce this when testing https://github.com/golang/appengine/blob/master/v2/aetest/instance_test.go for example. FYI, there is no error without aetest tests.

$ git clone https://github.com/golang/appengine.git
$ cd appengine/v2
$ GO111MODULE=on APPENGINE_DEV_APPSERVER="/path/to/dev_appserver.py" go test -v ./...
(omitted)
=== RUN   TestBasicAPICalls
/path/to/google-cloud-sdk/lib/third_party/google/auth/crypt/_cryptography_rsa.py:22: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  import cryptography.exceptions
INFO     2022-01-26 01:35:12,429 devappserver2.py:316] Skipping SDK update check.
WARNING  2022-01-26 01:35:12,429 devappserver2.py:332] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import x509
WARNING  2022-01-26 01:35:12,639 simple_search_stub.py:1196] Could not read search indexes from /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/appengine.testapp.kimie.furuya/search_indexes
INFO     2022-01-26 01:35:12,640 <string>:383] Starting API server at: http://localhost:56234
INFO     2022-01-26 01:35:12,748 dispatcher.py:281] Starting module "default" running at: http://localhost:56235
INFO     2022-01-26 01:35:12,751 admin_server.py:150] Starting admin server at: http://localhost:56237
ERROR    2022-01-26 01:35:13,769 instance_factory.py:250] Failed to build Go application: (Executed command: go build -o /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/tmpJWkEggappengine-go-bin/_ah_exe .)


go: cannot find main module; see 'go help modules'

WARNING  2022-01-26 01:35:13,770 instance.py:297] Could not get PID of instance
ERROR    2022-01-26 01:35:13,770 instance.py:300] '_GoBuildFailureRuntimeProxy' object has no attribute '_process'
INFO     2022-01-26 01:35:14,762 stub_util.py:334] Applying all pending transactions and saving the datastore
INFO     2022-01-26 01:35:14,762 stub_util.py:337] Saving search indexes
--- PASS: TestBasicAPICalls (3.94s)
=== RUN   TestContext
/path/to/google-cloud-sdk/lib/third_party/google/auth/crypt/_cryptography_rsa.py:22: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  import cryptography.exceptions
INFO     2022-01-26 01:35:16,339 devappserver2.py:316] Skipping SDK update check.
WARNING  2022-01-26 01:35:16,339 devappserver2.py:332] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import x509
WARNING  2022-01-26 01:35:16,552 simple_search_stub.py:1196] Could not read search indexes from /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/appengine.testapp.kimie.furuya/search_indexes
INFO     2022-01-26 01:35:16,553 <string>:383] Starting API server at: http://localhost:56246
INFO     2022-01-26 01:35:16,655 dispatcher.py:281] Starting module "default" running at: http://localhost:56247
INFO     2022-01-26 01:35:16,657 admin_server.py:150] Starting admin server at: http://localhost:56249
INFO     2022-01-26 01:35:17,660 stub_util.py:334] Applying all pending transactions and saving the datastore
INFO     2022-01-26 01:35:17,660 stub_util.py:337] Saving search indexes
ERROR    2022-01-26 01:35:17,679 instance_factory.py:250] Failed to build Go application: (Executed command: go build -o /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/tmpgzeo7Mappengine-go-bin/_ah_exe .)


go: cannot find main module; see 'go help modules'

--- PASS: TestContext (2.91s)
=== RUN   TestUsers
/path/to/google-cloud-sdk/lib/third_party/google/auth/crypt/_cryptography_rsa.py:22: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  import cryptography.exceptions
INFO     2022-01-26 01:35:19,342 devappserver2.py:316] Skipping SDK update check.
WARNING  2022-01-26 01:35:19,343 devappserver2.py:332] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import x509
WARNING  2022-01-26 01:35:19,554 simple_search_stub.py:1196] Could not read search indexes from /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/appengine.testapp.kimie.furuya/search_indexes
INFO     2022-01-26 01:35:19,556 <string>:383] Starting API server at: http://localhost:56255
INFO     2022-01-26 01:35:19,665 dispatcher.py:281] Starting module "default" running at: http://localhost:56256
INFO     2022-01-26 01:35:19,668 admin_server.py:150] Starting admin server at: http://localhost:56258
INFO     2022-01-26 01:35:20,673 stub_util.py:334] Applying all pending transactions and saving the datastore
INFO     2022-01-26 01:35:20,674 stub_util.py:337] Saving search indexes
ERROR    2022-01-26 01:35:20,689 instance_factory.py:250] Failed to build Go application: (Executed command: go build -o /var/folders/8q/_d527zhx5hbdj2myldmy6dw92x9mm8/T/tmpzkdKoTappengine-go-bin/_ah_exe .)


go: cannot find main module; see 'go help modules'

--- PASS: TestUsers (3.01s)
PASS
ok  	google.golang.org/appengine/v2/aetest	10.671s
(omitted)

Go version is

  • 1.15.15 darwin/amd64
  • 1.16.11 darwin/amd64

and python version is:

$ python -V
Python 3.9.10

// I have python 2 also.
$ python2 -V
Python 2.7.16

Gcloud version is:

$ gcloud version
Google Cloud SDK 370.0.0
alpha 2022.01.21
app-engine-go 1.9.71
app-engine-python 1.9.98
beta 2022.01.21
bq 2.0.73
cloud-datastore-emulator 2.1.0
core 2022.01.21
gsutil 5.6

If the owners want to create a new issue because I reported about appengine/v2/aetest, I will do. Someone please take a look this issue.

kimikimi714 avatar Jan 26 '22 02:01 kimikimi714

I checked CI result and found the same error: https://github.com/golang/appengine/runs/4720548742 .

kimikimi714 avatar Jan 26 '22 02:01 kimikimi714