Activities

jbty

jbty posted a new question

pwa-module •

How to using preCaching option ?

How to using preCaching option ?

In the doc there is no example for use preCaching option.

Can someone explain me, how to pre-cache my app when registering service worker ?

buglavecz

buglavecz posted a new bug report

pwa-module •

bug $OneSignal sometimes works in a PROD environment, sometimes not, in DEV enviroment works fine

Version

v3.0.0-beta.19

Reproduction link

https://github.com/nuxt-community/pwa-module

Steps to reproduce

I was create a trusted https on localhost for testing, there working fine with OneSignal.
But, in production environment sometimes working.

If not works, then I got this error, when refresh browser:

one-signal-error.jpg

I don't understand what is wrong?


I call OneSignal in mounted() hook in app layout.

this.$OneSignal.push(() => {

   this.$OneSignal.showNativePrompt();


    this.$OneSignal.isPushNotificationsEnabled((isEnabled) => {
    if (isEnabled) {
      console.log('Push notifications are enabled!')
    } else {
      console.log('Push notifications are not enabled yet.')
    }
  })
});

If I refresh many times the browser, then I got this (only in production):

one-signal-error-2.jpg

What is expected ?

Every page refresh show native prompt to user.

What is actually happening?

Sometimes show, sometimes not showing native prompt.

Additional comments?

I don't understand, why works on DEV env, and why not in PROD env. :-(

Please help!!!

watsab

watsab posted a new question

pwa-module •

Offline assets not working

Hi !

I'm facing an issue that I don't know how to solve: I'm working on a pwa application that must work offline. To ensure it works fine when offline I'm precaching assets using the offlineAssets option, but they do not seem to be precached as expected. Inded if they have not been explored before going offline I have a "net::ERRINTERNETDISCONNECTED".
Below is an extract of my nuxt.config.js with workbox conf:

workbox: {
dev: process.env.ENV === 'development',
offlineAnalytics: process.env.ENV !== 'development',
offlineAssets: [
'assets/placeholder/accessories.svg',
'assets/placeholder/document.svg',
'assets/placeholder/round.svg',
'assets/placeholder/square.svg',
'assets/placeholder/telecom.svg',
'assets/fonts/opensans/OpenSans-Bold.ttf',
'assets/fonts/opensans/OpenSans-Bold.woff',
'assets/fonts/opensans/OpenSans-Bold.woff2',
]
}

Do you have an idea of why they are not precached ?

BTW, I'm using nuxt/pwa with version 3.0.0-beta.19

Thanks !

boukadam

boukadam posted a new question

pwa-module •

OneSignal cannot register sw when deploying on Google App Engin

First of all, is it a good pratice to deploy a nuxt app under Google App Engine? I use cloudbuild to deploy when pushing on git repo :

App.yml
runtime: nodejs10
instanceclass: F2 envvariables:
HOST: '0.0.0.0'
NODE_ENV: 'production'

cloudbuild.yml
steps:

  • id: 'Install npx'
    name: 'gcr.io/cloud-builders/npm'
    args: ['install', 'npx']
  • id: 'Install dependencies'
    name: 'gcr.io/cloud-builders/npm'
    args: ['install']
  • id: 'Build app'
    name: 'gcr.io/cloud-builders/npm'
    args: ['run', 'generate']
  • id: 'Deploy app'
    name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy', 'app.yml']

This deploy the nuxt app in a nodejs environment. On startup, OneSignal try to generate sw on fly and got this error :

A 2019-12-27T19:00:23.915229Z ╭───────────────────────────────────────────────────────────────────────────────────╮
A 2019-12-27T19:00:23.915241Z │ │
A 2019-12-27T19:00:23.915253Z │ ✖ Nuxt Fatal Error │
A 2019-12-27T19:00:23.915294Z │ │
A 2019-12-27T19:00:23.915311Z │ Error: EROFS: read-only file system, open '/srv/static/OneSignalSDKWorker.js' │
A 2019-12-27T19:00:23.915320Z │ │
A 2019-12-27T19:00:23.915334Z ╰───────────────────────────────────────────────────────────────────────────────────╯

I understand that fs under App Engine is ready only, so it means that is impossible to deploy a nuxt app using OneSignal this way ?

Thanks.

liyasthomas

liyasthomas posted a new feature request

pwa-module •

idea No maskable icon support

What problem does this feature solve?

Maskable icons support for PWA is gaining pace in most browsers and still it is not supported in Nuxt PWA module

What does the proposed changes look like?

On nuxt.config.js adding purpose field to PWA images will make icons compatible for maskable icons.

Viruss98

Viruss98 posted a new question

pwa-module •

I have an issue when i have new data from api but workbox not replace old data from cache data with new data

I am using @nuxtjs/pwa , the first time running in website it look good but when i add a data into database (in page 1), and back to another page(page 2), and then i go back to the page 1, the data does not have the new data i added , but if i Ctrl + f5 the data i added is show, i don't know what the issue is ? I am using nuxt ^2.0.0 mode ssr, "@nuxtjs/pwa: ^3.0.0-0". Thanks you very much

Viruss98

Viruss98 posted a new question

pwa-module •

I have an issue when i have new data from api but workbox not replace old data from cache data

I am using @nuxtjs/pwa , the first time running in website it look good but when i add a data into database (in page 1), and back to another page(page 2), and then i go back to the page 1, the data does not have the new data i added , but if i Ctrl + f5 the data i added is show, i don't know what the issue is ? I am using nuxt ^2.0.0 mode ssr, "@nuxtjs/pwa: ^3.0.0-0". Thanks you very much

binzcodes

binzcodes posted a new question

pwa-module •

Unsure of format for ogHost, ogUrl

Hi, I'm struggling to figure out the correct format for ogHost and ogUrl
Should it be 'site.tld', 'https://www.site.tld' or an any be used?

I'm running with the former right now and seem to have a working PWA - but my CI gives me a URL variable in the latter format and wondering if I can switch to using that without issue.

I can't find anything in the docs or any examples in the wider internet.

If there's a general resource out there please point me in the right direction too.

Thanks!

Mohitpokra

Mohitpokra posted a new feature request

pwa-module •

idea In case of slow internet use cached data and after getting data from internet replace cached data with it.

What problem does this feature solve?

In case of slow internet app takes a lot of time to load the page, We can show cached data and whenever data form internet is available we can replace cached data with new one.

Mohitpokra

Mohitpokra posted a new question

pwa-module •

Don't fetch data from internet if cached data is available.

Every time when I visits a page it fetches data again from the internet, is there any way by which we can check first in cache if cache data is not available then we can fetch it form internet.

nachogarcia

nachogarcia posted a new question

pwa-module •

Environment Variables

I'm wondering if there is a way of passing environment variables to this module in runtime rather than in build time, so I can have the same build for different environments and just change the env var (I put just the build and needed node_modules in the docker image).

Do you think is worth to put something about this in the docs? After your response I'd be able to.

Mohitpokra

Mohitpokra posted a new question

pwa-module •

Don't fetch data from internet if cached data is available.

Every time when I visits a page it fetches data again from the internet, is there any way by which we can check first in cache if cache data is not available then we can fetch it form internet.

OsirisFrik

OsirisFrik posted a new bug report

pwa-module •

bug OneSignal don't pass init options

Version

v3.0.0-beta.16

Reproduction link

https://codesandbox.io/s/onesignal-6b1ew

Steps to reproduce

Set OneSignal settings and check in console

What is expected ?

Pass my settings to OneSignal config

What is actually happening?

Only pass AppId to the settings

burn4live

burn4live posted a new question

pwa-module •

window.OneSignal already defined as 'function'!

window.OneSignal already defined as 'function'!
Please make sure to define as 'window.OneSignal = window.OneSignal || [];' class Gt{static setDefaultNotificationUrl(e){return zt(this,void 0,void 0,function*(){if(!Ht.isValidUrl(e,{allowNull:!0}))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);yield Obje…

What is wrong here why do i get this error?

modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/auth',
'@nuxtjs/onesignal',
'@nuxtjs/pwa',
'nuxt-material-design-icons'
],
oneSignal: {
init: {
appId: 'MYAPPID',
allowLocalhostAsSecureOrigin: true,
welcomeNotification: {
disable: false
}
}
},

svale

svale posted a new feature request

pwa-module •

idea The `name`-attribute be removed when constructing open graph tags in the Meta module

What problem does this feature solve?

Thank you for providing a great plugin and module!

Currently the Meta module creates open graph meta tags with a both a name and property-attribute. The presence fo the name-attrib triggers "Warnings That Should Be Fixed" by the Facebook Sharing Debugger:

The following meta tags are specified using 'name' instead of 'property' and will be ignored unless specified using the 'property' key: og:type, og:title, og:site_name, og:description

(my emphasis on "will be ignored")

What does the proposed changes look like?

I suggest removing the name-attribute and go with property only.

I see that the issue has been commented on before, but the debugger feedback indicates that using the name-key might in fact not be valid. Also the Open Graph protocol specifies the use of property and content attributes for markup, and services like Twitter (which use name and content) documents supporting just property.

Removing ´name´ from og:-tags should have no detrimental effects, but ensure or improve propper parsing from e.g. Facebook.

Sidenote: A similar concern raised elsewhere (at Grav) was concluded by removing the name-attib (though with an unnecessary exception for twitter).

Would a PR for this modification be considered?

Thanks!

LeCoupa

LeCoupa posted a new question

pwa-module •

Disable add to home screen

Is there a way to disable the add to home screen banner to appear on mobile? I might be blind, but I can't find the options for this here.

svale

svale posted a new question

pwa-module •

Could attributes for og:-meta tags be adjusted? [moved]

[Moved to feature requests where it belonged]

just-tom

just-tom posted a new question

pwa-module •

Background sync

Hi guys,

I need to implement a background sync function with work box. Unfortunately I can’t find any resources on how to do this with Nuxt PWAs implementation.

I have read about using importScripts but this fails with an error saying workbox Config needs to be set to be able to use it.

I also tried to set the swURL to a custom file in static/ and then used importScript() to include the generated sw.js as suggested in other issues but still no luck.

Any suggestions on how to get an additional sw working to include background sync, would be much appreciated,

Thanks

P4sca1

P4sca1 resolved the question #c177

pwa-module •

OneSignal.push works but $nuxt.$OneSignal.push does not
P4sca1

P4sca1 posted a new bug report

pwa-module •

bug OneSignal.push works but $nuxt.$OneSignal.push does not

Version

v3.0.0-beta.19

Reproduction link

https://staging.ips-hosting.com

Steps to reproduce

I am having a problem in my production deploy where the callback provided to $nuxt.OneSignal.push() is never called.
Everything works fine in dev.

Environment:

ubuntu: 18.04
node: 12.13
nuxt: 2.10.2
@nuxtjs/pwa: 3.0.0-beta.19
mode: universal

Here are the results of some tests I did in the browser console:

$nuxt.$OneSignal.push(() => { console.log("test") })
undefined
OneSignal.push(() => { console.log("test") })
VM125:1 test
undefined

As you can see $nuxt.$OneSignal.push is not working but OneSignal.push is.

I provided the url to my staging deployment where you can test yourself.

What is expected ?

The callback provided to $nuxt.$OneSignal.push should also be called in production.

What is actually happening?

OneSignal.push works but $nuxt.$OneSignal.push does not.

Additional comments?

If that helps, here is my Dockerfile:

# Base
FROM node:12.13-alpine as base

# Required build args, mapped to environment variables.
# Using a base image allows us to share those environment variables between the builder and the final image.
# This makes sense, because most environment variables are required both during build and during runtime.
ARG URL
ENV URL=$URL
ARG API_URL
ENV API_URL=$API_URL
ARG GA_TRACKING_ID
ENV GA_TRACKING_ID=$GA_TRACKING_ID
ARG STRIPE_API_KEY
ENV STRIPE_API_KEY=$STRIPE_API_KEY
ARG PAYPAL_CLIENT_ID
ENV PAYPAL_CLIENT_ID=$PAYPAL_CLIENT_ID
ARG ONESIGNAL_APP_ID
ENV ONESIGNAL_APP_ID=$ONESIGNAL_APP_ID

# Builder
FROM base as builder

WORKDIR /home/node/app

COPY .npmrc .
COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build && npm prune --production

# Final image
FROM base

RUN apk add --update --no-cache curl

USER node

RUN mkdir /home/node/app
WORKDIR /home/node/app

ENV NODE_ENV=production

EXPOSE 3000/tcp

COPY --from=builder --chown=node:node /home/node/app/.nuxt ./.nuxt
COPY --from=builder --chown=node:node /home/node/app/server-middleware ./server-middleware
COPY --from=builder --chown=node:node /home/node/app/static ./static
COPY --from=builder --chown=node:node /home/node/app/workbox ./workbox
COPY --from=builder --chown=node:node /home/node/app/nuxt.config.js .
COPY --from=builder --chown=node:node /home/node/app/package.json .
COPY --from=builder --chown=node:node /home/node/app/node_modules ./node_modules
COPY --from=builder --chown=node:node /home/node/app/healthcheck.sh ./healthcheck.sh

HEALTHCHECK \
  --interval=15s \
  --timeout=3s \
  --retries=3 \
  CMD /bin/sh /home/node/app/healthcheck.sh

CMD ["npm", "start"]

OneSignalSDK* is added to my .dockerignore.