404 not found on /.well-known/assetlinks.json

1.7k views Asked by At

I am getting 404 error when accessing /.well-known/assetlinks.json on my site.

It works locally but not when I deploy it to Heroku. I am using Svelte on Sapper with polka server.

I tried adding it to the static folder, where all the other static resources work fine. Also tried with a dynamic route with no luck.

My guess is it might have to do with the leading dot or something wrong in my service-worker...

Any ideas on how to solve it or how to debug it?

1

There are 1 answers

0
fran On BEST ANSWER

Found the solution here: https://github.com/lukeed/sirv/tree/master/packages/sirv#optsextensions

opts.dotfiles Type: Boolean Default: false

Allow requests to dotfiles (files or directories beginning with a .). even if it says

Note: Requests to /.well-known/* are always allowed.

I had to specify the option as true.

Sample code:

polka({ server })
    .use(
    force_ssl,
        compression({ threshold: 0 }),
        sirv('static', { dev: dev, dotfiles: true }),
        sapper.middleware()
  )
    .listen(PORT, err => {
        if (err) console.log('error', err);
    });