PWA for Meteor/Swydo ddp-apollo? [SOLVED - it had nothing to do with PWA or Swydo]

Via this forum post, I found this elegant tutorial, “Transform any Meteor App into a PWA”. It was very easy to follow and implement.

When I ran my app after implementing this, I saw this in my server console logs:

20200520-21:41:50.650(-7)? Exception in onStop callback: TypeError: iterator.return is not a function
I20200520-21:41:50.650(-7)?     at Subscription.<anonymous> (packages/swydo:ddp-apollo/lib/server/createGraphQLPublication.js:56:27)
I20200520-21:41:50.650(-7)?     at runWithEnvironment (packages/meteor.js:1286:24)
I20200520-21:41:50.650(-7)?     at packages/meteor.js:1299:14
I20200520-21:41:50.650(-7)?     at packages/ddp-server/livedata_server.js:1158:7
I20200520-21:41:50.650(-7)?     at Array.forEach (<anonymous>)
I20200520-21:41:50.651(-7)?     at Function._.each._.forEach (packages/underscore.js:139:11)
I20200520-21:41:50.651(-7)?     at Subscription._callStopCallbacks (packages/ddp-server/livedata_server.js:1157:7)
I20200520-21:41:50.651(-7)?     at Subscription._deactivate (packages/ddp-server/livedata_server.js:1147:10)
I20200520-21:41:50.651(-7)?     at Session._stopSubscription (packages/ddp-server/livedata_server.js:873:18)
I20200520-21:41:50.651(-7)?     at Subscription.stop (packages/ddp-server/livedata_server.js:1215:19)
I20200520-21:41:50.651(-7)?     at packages/swydo:ddp-apollo/lib/server/createGraphQLPublication.js:68:24
I20200520-21:41:50.651(-7)?     at /Users/myUser-2020/.meteor/packages/promise/.0.11.2.158ss2l.tikp++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40

Is there a best practices way of adding PWA to a Meteor/Swydo ddp-apollo app yet?

Thanks very much in advance for any info!

Hi @vikr00001 unless you find a better answer in the meantime, you may follow the other PWA conversation.
PWA requires an understanding of the fetch API and unless you know exactly how fetch works, PWA will always mean troubles. This includes some strategies (network first, cache first, fall-backs, deal with CORS etc). From my experience, if I don’t understand these, I am always at the mercy of others writing a proper service worker that might apply to me and what I need to do.

1 Like

I hear that. Hmmm… I guess I may be better off waiting for the Meteor team to finish their PWA solution. Hopefully it will support Apollo. :slight_smile:

At the moment I wanted to be able to send the user notifications if a message for them comes in. I think it will be acceptable if I just email the user and/or send them an SMS in that case. That will probably be great for this use case.

Found it. It had nothing to do with the PWA or Swydo ddp-apollo! I just hadn’t noticed the server console log error message before.

I’d just recently added in an Apollo useSubscription hook. The subscription was working.

In the hook, I was using:

variables: {"localUserId": Meteor.userId()},

When Meteor.userId() was null and the hook ran, I got the error shown above. It was a type error and had nothing to do with PWA or Swydo ddp-apollo. :slight_smile: