Amphtml: amp-subscriptions: Allow platforms to register on free pages

Created on 19 Mar 2020  路  13Comments  路  Source: ampproject/amphtml

This is the third top error in this week's release (currently in beta): https://github.com/ampproject/amphtml/releases/tag/2003171848440

Error: null is not an object (evaluating 'c.l.resolvePlatform')
at resolvePlatform (https://raw.githubusercontent.com/ampproject/amphtml/2003171848440/extensions/amp-subscriptions/0.1/amp-subscriptions.js:222)

/cc @ampproject/wg-access-subscriptions

amp-subscriptions High Priority Bug access-subscriptions

All 13 comments

While getEntitlementPromiseFor error has been resolved, this one is still firing very frequently, and has ramped up with the promotion of 2003262059300 to Stable.

/cc @ChrisAntaki

I'm looking into it now, thanks for the heads up!

Looks like end users aren't affected. It's just amp-subscriptions-google can't register itself on free articles, and isn't failing gracefully. I'll start working on a fix!

Looks like end users aren't affected. It's just amp-subscriptions-google can't register itself on free articles, and isn't failing gracefully. I'll start working on a fix!

Nice investigating!

Hi guys, I'm getting this exact issue on production:
amp-subscriptions.js:299 Uncaught (in promise) TypeError: Cannot read property 'resolvePlatform' of null at amp-subscriptions.js:299
https://amp.pagina12.com.ar/258031-coronavirus-en-argentina-56-muertos-y-1628-infectados

We're using amp-subscriptions as Google Contributions (all our articles are free), and we use this not just to render the "contribute with google button", but also to check if the user is logged in or not.

Do you have any idea if this fix is already deployed? Thanks!

Howdy @juanmadurand !

If you take a peek at the fix #27556, you should see a label on there PR Use: In Beta/Experimental. This label is added automatically, and indicates that the fix is in a release build currently deployed to the Beta and Experimental channels; when it's promoted into stable, the PR will get labeled PR Use: In Stable (see Determining if your change is in a release). That build should be promoted to Stable this Wednesday, modulo any regressions or cherry-pick delays.

If you'd like to verify the fix on your site, you can opt-in to the Beta or Experimental channels and test the new release versions on your site.

Thanks @rcebulko! I did that, I can see the error is gone but I still have the issue that it's not calling the authorizationUrl configured, which returns the logged status of the user.

I saw that the fix #27556 disable fetching entitlements on free pages, and that breaks the functionality. So we cannot show/hide elements on free pages (all our pages) depending on the logged status:

<span subscriptions-actions subscriptions-display="NOT granted">
  Content for users without entitlements
</span>
<span subscriptions-actions subscriptions-display="granted">
  Premium content for logged users that have valid entitlements
</span>

I could use amp-access for this, but I should remove amp-subscriptions then, because they cannot coexist afaik. Can you reproduce this?

Hey Juan! Would it make sense to mark the article as not free?

Hi Chris! All our articles are free. We are a newspaper supported by contributions. That's why we're on the Google Contributions program, not subscriptions. Does that make sense?

Short term solution: If you want the auth endpoint to be called you'd need to mark that article as not free, however you don't need to markup any of the content as being protected so you can still grant access without payment.

Longer term we should provide a flag that says signal a free article with a contributions call to action @ChrisAntaki will you open a separate issue for that enhancement and we can discuss the best way to represent it.

Thanks guys! I'll try that. Marking the article as not free, does it have another implication?
I mean, could it affect the article indexing or change its visualization on another google product?

As long as your feed to the news app has it in a free section it won't change anything there. There should be no other implications.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mkhatib picture mkhatib  路  3Comments

choumx picture choumx  路  3Comments

aghassemi picture aghassemi  路  3Comments

Download picture Download  路  3Comments

mrjoro picture mrjoro  路  3Comments