# Invalid or unexpected token (at browser-detect...)

**URL:** https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919
**Category:** Support
**Created:** [March 29, 2023, 11:02pm UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919 "2023-03-29T23:02:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![V102918](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/v102918/32/300410_2.png) [@V102918](https://meta.discourse.org/u/V102918)
#### Post date: [March 29, 2023, 11:02pm UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/1 "2023-03-29T23:02:26Z")

</div>

Hi all,

I’m receiving some JS errors saying invalid or unexpected token, all coming from files that end in .gz.js

I had a look at this thread here: [Stackpath (Formerly MaxCDN) - Invalid or Unexpected Token](https://meta.discourse.org/t/stackpath-formerly-maxcdn-invalid-or-unexpected-token/111589) which suggests that the content-encoding header is missing, however it is present for those files and it shows Content-Encoding: br

What can I do to fix this?

Here’s the headers returned:

 ![CleanShot 2023-03-29 at 19.01.40@2x](https://global.discourse-cdn.com/meta/original/4X/4/e/8/4e80866151d50e0ff0a9256ffd8e12808b088563.jpeg)

Are there any other headers missing here that’s causing this?

Thanks for any help you can provide.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 29, 2023, 11:37pm UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/2 "2023-03-29T23:37:15Z")

</div>

Looks like your CDN is misconfigured. For example, [https://forumcdn.minnitchat.com/assets/browser-detect-18068a2d9ee3b1943a0bea70aa916d391f1dc6c03eeb7917ead5d6e0a637321a.gz.js](https://forumcdn.minnitchat.com/assets/browser-detect-18068a2d9ee3b1943a0bea70aa916d391f1dc6c03eeb7917ead5d6e0a637321a.gz.js) should have a content encoding of ` gzip` but the header is missing.

---

<div class="post-metadata">

### Author: ![V102918](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/v102918/32/300410_2.png) [@V102918](https://meta.discourse.org/u/V102918)
#### Post date: [March 30, 2023, 12:50am UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/4 "2023-03-30T00:50:04Z")

</div>

This error happened when I migrated from DigitalOcean Spaces to Backblaze.

It seems that the Content-Encoding metadata wasn’t transferred over when I copied over files from DigitalOcean Spaces to Backblaze.

So I decided to delete the assets folder in Backblaze.

Is there a way to force all of the assets to be reuploaded?

When I run `rake s3:upload_assets`, I see the following:

```plaintext
rake s3:upload_assets --verbose
Installing CORS rules...
skipping
Skipping: assets/discourse-57df4f51068d4926f4e9170d2001380eadd7942574a11a99540a7fb39a0d5933.js
Skipping: assets/discourse-57df4f51068d4926f4e9170d2001380eadd7942574a11a99540a7fb39a0d5933.br.js
Skipping: assets/discourse-57df4f51068d4926f4e9170d2001380eadd7942574a11a99540a7fb39a0d5933.gz.js
Skipping: assets/vendor-01a1a73134b66697f73050c52550416a7a4ca1be2731823d24d3c3db03de62dc.js
Skipping: assets/vendor-01a1a73134b66697f73050c52550416a7a4ca1be2731823d24d3c3db03de62dc.br.js
Skipping: assets/vendor-01a1a73134b66697f73050c52550416a7a4ca1be2731823d24d3c3db03de62dc.gz.js
Skipping: assets/admin-e9a41caf10a7034a459f1ea903e10fdf4b4521ccfc457f9a4eec9a2f202968d9.js
Skipping: assets/admin-e9a41caf10a7034a459f1ea903e10fdf4b4521ccfc457f9a4eec9a2f202968d9.br.js
Skipping: assets/admin-e9a41caf10a7034a459f1ea903e10fdf4b4521ccfc457f9a4eec9a2f202968d9.gz.js
Skipping: assets/wizard-2a333f23a04838384081055016eee4318c873ebc8188d13fa84c86b12deabd7a.js
Skipping: assets/wizard-2a333f23a04838384081055016eee4318c873ebc8188d13fa84c86b12deabd7a.br.js
Skipping: assets/wizard-2a333f23a04838384081055016eee4318c873ebc8188d13fa84c86b12deabd7a.gz.js
Skipping: assets/test-support-9ed31303d935a668f483d777d27ba04733f5c99d518b1379b45b3959f53937ea.js
Skipping: assets/test-support-9ed31303d935a668f483d777d27ba04733f5c99d518b1379b45b3959f53937ea.br.js
Skipping: assets/test-support-9ed31303d935a668f483d777d27ba04733f5c99d518b1379b45b3959f53937ea.gz.js
Skipping: assets/test-support-9ed31303d935a668f483d777d27ba04733f5c99d518b1379b45b3959f53937ea.js.map
Skipping: assets/test-helpers-b76fd4fd8c6b418680cdb0cacdebb7946b25abec19237a0d15d174b01b3f36eb.js
Skipping: assets/test-helpers-b76fd4fd8c6b418680cdb0cacdebb7946b25abec19237a0d15d174b01b3f36eb.br.js
Skipping: assets/test-helpers-b76fd4fd8c6b418680cdb0cacdebb7946b25abec19237a0d15d174b01b3f36eb.gz.js
Skipping: assets/test-helpers-b76fd4fd8c6b418680cdb0cacdebb7946b25abec19237a0d15d174b01b3f36eb.js.map
Skipping: assets/test-site-settings-3e7fd4983053d4b7813cac2dce831768a7bc09d15e2d563b026a4a805ca4477e.js
Skipping: assets/test-site-settings-3e7fd4983053d4b7813cac2dce831768a7bc09d15e2d563b026a4a805ca4477e.br.js
Skipping: assets/test-site-settings-3e7fd4983053d4b7813cac2dce831768a7bc09d15e2d563b026a4a805ca4477e.gz.js
....

```

How do I force it to reupload those assets into Backblaze?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 30, 2023, 1:10am UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/5 "2023-03-30T01:10:44Z")

</div>

A rebuild should re-upload all missing assets

---

<div class="post-metadata">

### Author: ![V102918](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/v102918/32/300410_2.png) [@V102918](https://meta.discourse.org/u/V102918)
#### Post date: [March 30, 2023, 1:15am UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/6 "2023-03-30T01:15:04Z")

</div>

Thanks – I ran a rebuild and it seems to be working properly now (after clearing cache)

Appreciate your help

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 29, 2023, 1:15am UTC](https://meta.discourse.org/t/invalid-or-unexpected-token-at-browser-detect/259919/7 "2023-04-29T01:15:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
