enable user-bootstrapping when secrets are present#20267
Conversation
|
currently getting an error in docker: |
|
Maybe this: https://github.com/Automattic/wp-calypso/blob/master/server/pages/index.pug#L79 And |
|
Hmm, seems to wfm. |
|
Sorry for letting this hang for so long. Completely fell off my radar. |
|
I was able to diagnose the issue to being caused by a lack of Lets continue the discussion of how to handle this in slack instead of GH. |
c7ec448 to
15ca372
Compare
|
Can we merge this without the changes to IMO, |
yes and no :). The broken 500 error was fixed just by moving the context higher up which is pretty safe. That said, there still is one more fix that needs to go in here. Namely that the server still crashes when |
|
Even though this is a small PR, there is a lot of background info needed to understand its motivation and how to test. I'll try to break down some of that here. First off, Calypso uses server-side-rendering to render certain pages like So the solution seems straightforward right? We want local docker development to be easy to setup. After re-enabling user-bootstrapping for all stages post changelog:
testing instructionsThere are two situations that need to be tested. one is when with secrets.json
without secrets.json
|
| console.error( 'Disabling server-side user-bootstrapping because of a missing secrets.json' ); | ||
| data.features[ 'wpcom-user-bootstrap' ] = false; | ||
| } | ||
|
|
There was a problem hiding this comment.
Hmm, the config parser is a place where I wouldn't expect this.
Would a viable alternative be to add these checks explicitly where we're now checking for config.isEnabled( 'wpcom-user-bootstrap' )?
There was a problem hiding this comment.
i agree it isn't ideal. the client doesn't have access to the secrets though :/.
we can make it more generic in: 'disableSecretsRequiredFeatures' but lets leave that till there are more
There was a problem hiding this comment.
Hmm, I've noticed client/ side checks for config.isEnabled( 'wpcom-user-bootstrap' ) now, but are those even necessary? We should be able to simply check if the server is giving us a window.currentUser object in bootstrapping -- possibly having the server set it to false if bootstrapping is off...
There was a problem hiding this comment.
(Fine to do in another PR I guess so we don't block the upgrade any longer.)
There was a problem hiding this comment.
We should be able to simply check if the server is giving us a window.currentUser
thats a good idea! and would clean this up.
(Fine to do in another PR I guess so we don't block the upgrade any longer.)
that would be my vote. I'll make an issue for it now. I'm wary of diving down more rabbit holes right now in case that turns out to be more complicated than we expect. I also wouldn't want to add even more fixes onto this pr.
| expect( serverData.features[ 'wpcom-user-bootstrap' ] ).toBe( false ); | ||
| expect( clientData.features[ 'wpcom-user-bootstrap' ] ).toBe( false ); | ||
| expect( errorSpy ).toHaveBeenCalledTimes( 1 ); | ||
| } ); |
|
@samouri I just pushed e922fa4 to get rid of the temporary |
|
|
||
| if ( typeof API_KEY !== 'string' ) { | ||
| throw new Error( 'Unable to boostrap user because of invalid API key in secrets.json' ); | ||
| callback( new Error( 'Unable to boostrap user because of invalid API key in secrets.json' ) ); |
|
@ockham: thanks for the commit! I like it 👍 |
|
I'm not sure how to really test this besides just trying it out. I'm not familiar enough with the code but am under the impression that things are "already broken" in production. My recommendation would thus be to plan and announce a deployment where we ask everyone to do a few things after deploying to quickly confirm that there aren't any surprises we didn't anticipate. |
dmsnell
left a comment
There was a problem hiding this comment.
@samouri I did not test this but in Slack you told me that you did (following your instructions)
I'm not confident in my ability to verify the code changes or your testing instructions, but it feels like this should be a good change and I see no problems with the code.
If we were voting I'd say let's just merge, test, deploy, and test this in the morning on some non-Friday non-weekend day soon and ask everyone who's around to do some basic normal testing in case this change has consequences that aren't obvious.
|
Ha! My scheme worked. I've successfully tricked @sirreal into thoroughly testing the functionality introduced here in the React 16 PR!! I'll ship this within the hour ⭐️ |
User bootstrapping was disabled in
staging,horizon, andwpcalypsoin #17849 -- this was intended to be a test and then if successful it would also be disabled in production. However, issues with localization were discovered in staging.This PR re-enables user-bootstrapping. Since it was never disabled in production, this PR should have no effect to users but should ideally unblock React 16.
Next Steps