[Fixed] Adding Google Service to application

Continuing the discussion from "Sign in with Google" a paid option?:

I Thought this was my solution, but I am getting the following error when adding the google service as well.

see below:

EDIT : Occurs in beta and classic IDE

I add the google service. the saving spinner starts up. Then the above error pops up.

1 Like

I’m not able to replicate in a quick attempt using the Beta editor.

Did your issue start with the Users service as in the discussion you reference?

What happens if you refresh the browser? I’m guessing it still shows that error?

Where does that error show up in the browser?

1 Like

Yes I tried checking the box and it led me to your post.

Still shows up.

Here is a zoomed out view, its the entire IDE.

1 Like

I tried that on an existing app that didn’t previously have the Users or Google services added, and it automatically added the Google service for me, with everything apparently working fine. But I have a paid account now, so maybe that is the difference. Are you experiencing this on a free account?

No, this is on the business plan, The app has existed for quite some time though and has multiple published versions.

I wonder if that could be the issue.

I tried on the master/published branch.

I did work in my other application, I did it as a test.

1 Like

Hi @anthonys,

Are you able to post the output of your browser’s JS console when the error occurs? That will help us to narrow down the issue. Thanks!

[Moved to bug reports]

1 Like

It attempts this PUT 3 times then outputs the following error:

saving.js:190          PUT https://anvil.works/ide/apps/<app_id_removed_for_abundance_of_caution>make_fresh_version=false&branch=master 500 (Internal Server Error)

Thank you!

react-dom.production.min.js:196 TypeError: Cannot read properties of undefined (reading 'services')
    at services.js:434:30
    at index.js:80:37
    at index.js:30:25
    at Function.mapToProps (GoogleServiceTab.jsx:39:20)
    at r (wrapMapToProps.js:41:92)
    at selectorFactory.js:44:26
    at selectorFactory.js:63:32
    at e.d [as onStateChange] (connectAdvanced.js:64:23)
    at t.handleChangeWrapper (Subscription.js:97:12)
    at Subscription.js:23:20
ps @ react-dom.production.min.js:196
As.n.payload @ react-dom.production.min.js:211
Oo @ react-dom.production.min.js:128
Mo @ react-dom.production.min.js:129
Ga @ react-dom.production.min.js:178
Ts @ react-dom.production.min.js:261
bl @ react-dom.production.min.js:230
gl @ react-dom.production.min.js:229
ll @ react-dom.production.min.js:223
(anonymous) @ react-dom.production.min.js:121
t.unstable_runWithPriority @ scheduler.production.min.js:18
Fi @ react-dom.production.min.js:120
Gi @ react-dom.production.min.js:121
Zi @ react-dom.production.min.js:120
cl @ react-dom.production.min.js:224
notify @ Subscription.js:19
t.notifyNestedSubs @ Subscription.js:92
t.handleChangeWrapper @ Subscription.js:97
g @ redux.js:221
(anonymous) @ store.js:116
(anonymous) @ redux-logger.js:1
(anonymous) @ store.js:93
(anonymous) @ store.js:64
(anonymous) @ index.js:11
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ store.js:220
(anonymous) @ saving.js:276
u @ runtime.js:63
(anonymous) @ runtime.js:293
(anonymous) @ runtime.js:118
i @ asyncToGenerator.js:5
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ export.js:15
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ saving.js:110
(anonymous) @ store.js:226
(anonymous) @ index.js:8
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ store.js:47
setTimeout (async)
(anonymous) @ function-bind-context.js:22
(anonymous) @ store.js:45
(anonymous) @ index.js:11
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ saving.js:105
(anonymous) @ store.js:226
(anonymous) @ index.js:8
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ index.js:301
u @ runtime.js:63
(anonymous) @ runtime.js:293
(anonymous) @ runtime.js:118
i @ asyncToGenerator.js:5
s @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ export.js:15
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ index.js:294
(anonymous) @ store.js:226
(anonymous) @ index.js:8
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ services.js:194
u @ runtime.js:63
(anonymous) @ runtime.js:293
(anonymous) @ runtime.js:118
i @ asyncToGenerator.js:5
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ export.js:15
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ services.js:125
(anonymous) @ store.js:226
(anonymous) @ index.js:8
(anonymous) @ store.js:240
dispatch @ redux.js:638
(anonymous) @ services.js:79
u @ runtime.js:63
(anonymous) @ runtime.js:293
(anonymous) @ runtime.js:118
i @ asyncToGenerator.js:5
s @ asyncToGenerator.js:27
Promise.then (async)
i @ asyncToGenerator.js:15
s @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ export.js:15
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ services.js:68
(anonymous) @ store.js:226
(anonymous) @ index.js:8
(anonymous) @ store.js:240
(anonymous) @ Sidebar.jsx:303
u @ runtime.js:63
(anonymous) @ runtime.js:293
(anonymous) @ runtime.js:118
i @ asyncToGenerator.js:5
s @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ export.js:15
(anonymous) @ asyncToGenerator.js:23
onClick @ LinkInternal.jsx:35
m @ react-dom.production.min.js:15
M @ react-dom.production.min.js:15
(anonymous) @ react-dom.production.min.js:16
k @ react-dom.production.min.js:16
L @ react-dom.production.min.js:17
A @ react-dom.production.min.js:17
$ @ react-dom.production.min.js:17
wn @ react-dom.production.min.js:81
ce @ react-dom.production.min.js:283
Ln @ react-dom.production.min.js:83
Cn @ react-dom.production.min.js:84
$n @ react-dom.production.min.js:84
t.unstable_runWithPriority @ scheduler.production.min.js:18
Fi @ react-dom.production.min.js:120
se @ react-dom.production.min.js:283
An @ react-dom.production.min.js:82
Show 38 more frames
ErrorBoundary.jsx:17 TypeError: Cannot read properties of undefined (reading 'services')
    at services.js:434:30
    at index.js:80:37
    at index.js:30:25
    at Function.mapToProps (GoogleServiceTab.jsx:39:20)
    at r (wrapMapToProps.js:41:92)
    at selectorFactory.js:44:26
    at selectorFactory.js:63:32
    at e.d [as onStateChange] (connectAdvanced.js:64:23)
    at t.handleChangeWrapper (Subscription.js:97:12)
    at Subscription.js:23:20

Thank you!

1 Like

revisiting this.

I attempted again.

I also get the following error in the JS console

https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=undefined
{
  "error_description": "Invalid Value"
}

Hi @anthonys,

thanks for your patience, we think we’ve got to the bottom of this.
We think it’s because of the size of the app.

If you go to your “look and feel” settings,
turn off Auto Import Services and then try to add google, it should work.

We’ve found that adding the google service, causes all your code to get updated, which then causes the save mechanism to fail.
With Auto Import Services turned off, the code won’t be updated.

We’ll be fixing the underlying issue
and hopefully you’ll now be able to add the Google Service :smile:

2 Likes

This worked! Thank you very much!

Curious what you meant by

What exactly is the code updated against?
And can I turn it on after google services is added?

With Auto Import Services turned on, when you add the Google Service, Anvil adds a line to the top of every module importing the Google stuff. (I’m not sure if the “Auto Import Services” toggle is in the docs yet, but see this feature request: [BETA] Don't add unwanted imports)

2 Likes

Thank you Tim! That clears things up.

The underlying save mechanism has now been fixed, so this shouldn’t happen again.

2 Likes