Can't Deploy Go app Error 422 to AppEngine - google-app-engine

Suddenly can't deploy Go app to GAE. Haven't changed any of the code and Works fine on local.
03:39 PM Error 422: --- begin server output ---
Compile failed:
2016/10/14 12:39:46 go-app-builder: Failed parsing input: package main must be the top-level package
--- end server output ---
Since it's a cloud app I don't have a Main package - everything was fine a few days ago. I'm on Windows 10 and got and update a few days ago...
I did update to the latest Go Cloud SDK but get the same error.

Do you have any non-imported subdirectories in your app directory that may contain package main? I've jumped to the conclusion that go-app-builder is applying the equivalent of go tool vet ./... (instead of go tool vet .) and is using an old version. I recently started encountering this error while deploying:
01:05 PM Error 422: --- begin server output ---
Compile failed:
2016/10/19 10:05:23 go-app-builder: Failed parsing input (2 errors)
2016/10/19 10:05:23 appleasn1.go:16:25: composite struct literal encoding/asn1.ObjectIdentifier with unkeyed fields
2016/10/19 10:05:23 appleasn1.go:17:25: composite struct literal encoding/asn1.ObjectIdentifier with unkeyed fields
--- end server output ---
01:05 PM Rolling back the update.
asn1.ObjectIdentifier is an alias for []int, so this is not a composite struct literal. This bug in vet was fixed six months ago. I shared my findings with GCloud Support, and they've assured me they're on it. As a workaround, I've made my code pass the overly strict go vet process. If you have a subdirectory in your app that contains package main, you can exclude it in your app.yaml with a skip_files directive:
skip_files:
- bench/.*
- testdata/.*
The fix for the composite error involved changing from this:
oidData = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 1}
to this:
oidData = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 7, 1})

EDITED:
This issue stems from App Engine Standard's new ability for apps to provide their own main package with a main function, as explained in our public Google Groups post. The workaround is to add nobuild_files: commands/.* to your 'app.yaml'. The official fix for this will be release in the next SDK 1.9.47.
In the meantime, if you have a 'main.go' file, ensure that it is in the same directory level from where you are deploying (aka the top-level package). Also ensure that you are providing the required appengine.Main() within your main function as explained in the source code.
I also recommend adding in // +build !appengine at the top of your 'main.go' as shown in the helloworld example. This will tell App Engine to skip trying to upload or compile any unused code, which may also be the cause of the deployment failure.

Related

GAE java/python logs export not exporting latest logs

not sure if Google App Engine changed something, but I was able to download logs until recently to parse the logs for generating custom analytics on usage etc. Now the log is getting exported but the issue is that the last log is from Nov 23 while I see logs as recent as 12/18 in the console. The commandline version I use is as below.
appcfg.cmd -n 90 --severity=1 request_logs <appDirPath> <full_log_file_path>
Has anything changed recently with logs export with GAE ? Does anyone know a workaround for this issue. If it matters, I am using appengine-java-sdk-1.9.64.
I finally figured out the issue. Posting here in case anyone else runs into similar silly issue. After upgrading to google-cloud-sdk and Java 8, I am getting the following log in console
Configuration Warning : <application>/<version> XML elements and --application/--version should not be specified when staging
The following parameters will be scrubbed from app.yaml
application : appId
version : chosenVersion
Since google app engine was ignoring this, it was creating a new version with dateTimeStamp with new deployment. But the command line in my post points to the appDirPath that has the appengine-web.xml listing a version and so it was downloading the logs for that version only. Since that version was overridden with a new dynamic version on Nov 24, the command line was giving only logs till Nov 23. It took me a while to figure out so posting for anyone else who run into this issue.

Strange build failure when deploying GAE using gradle

Everything used to work fine until today. Didn't change anything as far as I know and now I get this:
C:\mypath>gradle appengineDeploy
> Configure project :
WARNING: You are a using release candidate 2.0.0-rc1. Behavior of this plugin has changed since 1.3.5. Please see release notes at: https://github.com/GoogleCloudPlatform/app-gradle-plugin.
Missing a feature? Can't get it to work?, please file a bug at: https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues.
> Task :appengineDeploy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':appengineDeploy'.
> Deployment version must be defined or configured to read from system state
1. Set appengine.deploy.version = 'my-version'
2. Set appengine.deploy.version = 'GCLOUD_CONFIG' to have gcloud generate a version for you.
3. Using APPENGINE_CONFIG is not allowed for flexible environment projects
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 6s
8 actionable tasks: 6 executed, 2 up-to-date
I just updated gradle from version 4.5.1 to 4.8.1 but the same issue remains. I understand it complains about version of the appengine but I never had to state that before so I think it's due to some update on Google's side. What am I missing?
You are now using the app-gradle-plugin version 2.0.0-rc1 as I can see from your console output, which was released 2 days ago. It has some changes, which the developers of the plugin documented.
As you can see in the Change Log of this release candidate from google, it mentions in the changes:
project and version are no longer pulled from the global gcloud state by default. project must be configured in build.gradle using the deploy.project property, users may use special keywords for project to specify that they would like to read it from appengine-web.xml (project = "APPENGINE_CONFIG") or from gcloud global state (project = "GCLOUD_CONFIG"). version is also configured the same way.
So you just have to specify in your gradle.build the following:
appengine {
deploy {
version = "GCLOUD_CONFIG"
project = "GCLOUD_CONFIG"
}
}
Update in 2.0.0-rc3 (Thanks to #wildcat12 for pointing it out)
in the latest version 2.0.0-rc3, the project configuration property has changed.
Changed appengine.deploy.project -> appengine.deploy.projectId
Therefore, now your gradle.build configuration would look like that:
appengine {
deploy {
version = "GCLOUD_CONFIG"
projectId = "GCLOUD_CONFIG"
}
}
If you are using
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
line in your build.gradle file you are using the 2.0.0-rc3 release candidate version now. It is working well with last stable version: 1.3.5.

appcfg.py migrate_traffic using app engine modules

I'm attempting to use appcfg.py migrate_traffic, but I get a 500 error when using this with a module. The documentation states that a module can be specified:
The 'migrate_traffic' command gradually gradually sends an increasing fraction
of traffic your app's traffic from the current default version to another
version. Once all traffic has been migrated, the new version is set as the
default version.
app.yaml specifies the target application, version, and (optionally) module; use
the --application, --version and --module flags to override these values.
Can be thought of as an enhanced version of the 'set_default_version'
command.
If I try this with a module, I get the following error
Error 500: --- begin server output ---
Server Error (500)
A server error has occurred.
--- end server output ---
The source at https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/appcfg.py?r=396 (MigrateTraffic) doesn't seem to use the module at all. Is this a bug in appcfg.py or a missing feature of app engine?
I filed a ticket with google support. The answer is that modules are not supported with migrate_traffic yet. No ETA on when they might be supported. I think the current version of appcfg.py doesn't mention modules as prominently in the help for migrate_traffic as well.

Google app engine error, don't know where to start looking

I'm receiving this error when I attempt to start an app using google app engine :
Loading modules
com.bookmark.Mobile_bookmark
[ERROR] Unable to find 'com/bookmark/Mobile_bookmark.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
I don't have a file called Mobile_bookmark.gwt.xml. My project name is mobile-bookmark
Why is this error occuring ?
If it's looking for Mobile_bookmark.gwt.xml (the wrong file), I'd check how you are starting the server.
For example, under Eclipse, I'd check run configurations --> arguments to see if "Mobile_bookmark" got into there. (you can get to run configurations by selecting the little triangle next to either the green debug or run button you use to start it --- or RUN (menu in eclipse) -- run configurations -- select your project)
Change the file name to whatever *.gwt.xml file you do have. I suspect it's mobile-bookmark.gwt.xml.
Look under /src/yourpath/yourproject/
Your layout is probably like:
/src/yourpath/yourproject/*.gwt.xml
/src/yourpath/yourproject/client
/src/yourpath/yourproject/server

Error while starting a GAE/GWT project: Unable to restore the previous TimeZone

When I try to run a GWT App Engine project using the Eclipse plugin, I get the following error:
Initializing App Engine server
[ERROR] Unable to start App Engine server
java.lang.RuntimeException: Unable to restore the previous TimeZone
at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:228)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:164)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.NoSuchFieldException: defaultZoneTL
at java.lang.Class.getDeclaredField(Class.java:1899)
at com.google.appengine.tools.development.DevAppServerImpl.restoreLocalTimeZone(DevAppServerImpl.java:222)
... 6 more
[ERROR] shell failed in doStartupServer method
Unable to start embedded HTTP server
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:102)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Chris Cashwell provided the correct answer. But for people like myself who are relatively new to Eclipse, here are more explicit instructions (which I came across here):
Right-click project directory in Project Explorer window
Select Run As > Run Configurations...
Go to Arguments tab
In VM Arguments textbox, add one of the following parameters mentioned by Chris:
-Dappengine.user.timezone.impl=UTC (this worked in my case)
-Dappengine.user.timezone=UTC
Click Apply then Run
In my case, this was done specifically in the context of a PlayN project I am working on, so I was right-clicking the HTML folder. In the end, my VM arguments looked something like this:
-Xmx512m -javaagent:/long/path/to/appengine-agent.jar -Dappengine.user.timezone.impl=UTC
See this bug report. For me, it was fixed by downgrading the JDK from 1.7.0_03 -> 1.7.0_02. Other things that have been purported to work are adding -Dappengine.user.timezone=UTC (or in some cases -Dappengine.user.timezone.impl=UTC) to the JVM flags.
i got this error, and found port already in use in the console.
I closed eclipse and killed javaw.exe. Then everything worked fine.

Resources