Big Bug: Cloud SQL completely broken? Steps and solution.

129 views
Skip to first unread message

webm...@trytha.com

unread,
Mar 18, 2016, 4:55:21 PM3/18/16
to web2py-users
Steps to replicate (3 mins):

  1. Load Web2py from source off website.  Copy gaehandler.py and app.yaml to /web2py.  
  2. In applications/welcome/models/db.py, change the DAL connection to "db = DAL('google:sql://[$project]:[$instance]/[$database]')"
  3. python dev_appserver.py --host=0.0.0.0 --mysql_host=localhost --mysql_port=3306 --mysql_user=root --mysql_password=**** /home/www-data/web2py
  4. Load, then refresh the Welcome app and it crashes because it thinks it can't access the /databases folder.
Solution (1 min):
  1. Delete /gluon/packages/dal/pydal
  2. Replace with /gluon/packages/dal/pydal from version 2.12.2 of web2py.  (http://web2py.com/examples/static/2.12.2/web2py_src.zip)
Am I doing something really crazy?  How has nobody run across this in the six months it's been broken?  Seems like kind of a massive bug.

Massimo Di Pierro

unread,
Mar 18, 2016, 6:28:15 PM3/18/16
to web2py-users
gae on 2.12.2 was broken. It is no broken in current stable and trunk.

webm...@trytha.com

unread,
Mar 18, 2016, 6:42:34 PM3/18/16
to web...@googlegroups.com
2.12.2 is definitely not broken, since that's what I've been using live on GAE for about six months.  (www.trytha.com)

I did the precise steps I outline above while I was preparing the post.  Not much to it, and it started working again as soon as I replaced the new /pydal with the old.  I've been beating my head against this for two days.  I thought it was just a problem I was having deploying locally since I had gotten things working on GAE last year (I had skipped a local GAE deployment at that time).  This morning I decided to just try my known, server-side-working app (2.12.2) locally and it worked with no issues.  That's when I started swapping out directories until I found the offender was /pydal.  I also tested 2.12.3 and it does NOT work.

I would really love to be using the latest version.  Hopefully if it's a mistake on my end, you might have some insight into where I've stepped off the path.

webm...@trytha.com

unread,
Mar 18, 2016, 6:48:13 PM3/18/16
to web2py-users
All done on an Ubuntu Server 14.04 VM running on an OSX El Capitan host.

Massimo Di Pierro

unread,
Mar 19, 2016, 3:25:02 AM3/19/16
to web2py-users
I will get to the bottom of this tomorrow. It is a promise.

webm...@trytha.com

unread,
Mar 19, 2016, 5:23:35 AM3/19/16
to web2py-users
No rush for me.  I'm satisfied with my temporary fix since I can finally get back to actual coding.  Thanks for making such a pleasant framework.

Massimo Di Pierro

unread,
Mar 19, 2016, 4:09:16 PM3/19/16
to web2py-users
I tested this. I am using trunk code with latest github and I cannot reproduce. I am pretty sure this is fixed. Make sure you have the latest pydal.


On Friday, 18 March 2016 15:55:21 UTC-5, webm...@trytha.com wrote:

webm...@trytha.com

unread,
Mar 19, 2016, 5:57:11 PM3/19/16
to web2py-users
And thus we discover the true problem.  Try using pydal from http://www.web2py.com/examples/static/web2py_src.zip (the link from Source Code for Normal Users).  -result:  Failure

Now try the pydal from http://web2py.com/examples/static/2.12.2/web2py_src.zip -result:  Success

Now try the pydal from http://web2py.com/examples/static/2.13.3/web2py_src.zip (apparently the latest one accessible by specific version number) -result:  Failure

So..... I hate you so much right now.  Give me back my two days!

There needs to be a way to mark your own answer as the "best answer"...

webm...@trytha.com

unread,
Mar 19, 2016, 6:36:37 PM3/19/16
to web2py-users
As penance, you can tell me how to store images in the datastore while using Cloud SQL for everything else (I haven't seen any actual examples of using both at the same time, but the book says it can be done).

Massimo Di Pierro

unread,
Mar 21, 2016, 1:22:20 AM3/21/16
to web2py-users
So can you confirm the latest pydal works for you?

webm...@trytha.com

unread,
Mar 21, 2016, 1:41:15 AM3/21/16
to web2py-users
From the git repo, yes.  From the current source files on web2py.com, no.

Massimo Di Pierro

unread,
Mar 21, 2016, 6:29:48 PM3/21/16
to web2py-users
we will post a new stable version tomorrow I think.

webm...@trytha.com

unread,
Mar 21, 2016, 8:21:31 PM3/21/16
to web2py-users
Cool beans.  Look forward to giving it a whirl.

Massimo Di Pierro

unread,
Mar 21, 2016, 8:50:40 PM3/21/16
to web2py-users
please try the latest nightly build from the web page.

webm...@trytha.com

unread,
Apr 30, 2017, 7:42:04 PM4/30/17
to web2py-users
Have you completely given up on Cloud SQL support?  I just checked back after a year and it's STILL broken.  The last version of DAL that works with Cloud SQL I'm aware of is 2.12.2...

The original hack I detail at the top is still the only way to get Cloud SQL working...

OK, I went through github and this is this seems to be the last commit that broke Cloud SQL (the version of pydal from the previous commit seems to work fine):  https://github.com/web2py/pydal/commit/4fee2923db00763c4a4666c5ad0e5c1104e8f24a

Also, this is the only way to get lost password requests working on GAE right now:  https://groups.google.com/forum/#!topic/web2py/YndwuzoEypw
Reply all
Reply to author
Forward
0 new messages