JSON Parse Error appears randomly on some runs
Problem
Executing bundle exec rake appengine:exec GAE_CONFIG=xxxx GAE_TIMEOUT=xx -- bundle exec bin/rails db:migrate on Gitlab CI/CD, some times throws an error related with JSON parser. After rerunning the job, it works perfectly (without any change on code nor files). There is no pattern apparently.
The target system is deployed on App Engine Standard, we've migrated from App Engine Flexible where it used to work perfectly, so it could be related to some App Engine Standard specific configuration.
Trace
---------- EXECUTE COMMAND ----------
COMMAND: ["bundle", "exec", "bin/rails", "db:migrate"]
---------- CLEANUP ----------
Deleting the following versions:
- XXXXXXXXXXXXXXXXXXXXXXXXXX
Deleting [default/appengine-exec-XXXXXXXXXX]...
.....done.
rake aborted!
JSON::ParserError: 783: unexpected token at ''
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => appengine:exec
(See full trace by running task with --trace)
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
Versions
appengine-ruby: 0.6.0 ruby: 2.6.2 rails version: 6.0.2.2 App Engine Standard
As of today, I am also experiencing a similar issue on one project when migrating with appengine. Temporarily I solved it by creating a migration script and putting it as an entrypoint on app.yaml