Roots Discourse

XMLHttpRequest cannot load hot-update.json due to access control checks

sage9
#1

Seems as though the initial page load works with Sage but when Browsersync reloads the page, nothing changes.

I noticed these errors in the console:

[Error] Origin http://localhost:3002 is not allowed by Access-Control-Allow-Origin.
[Error] Failed to load resource: Origin http://localhost:3002 is not allowed by Access-Control-Allow-Origin. (2e1ebcbd6a2e8ebb9a87.hot-update.json, line 0)
[Error] XMLHttpRequest cannot load http://localhost:3000/app/themes/ssafd-theme/dist/2e1ebcbd6a2e8ebb9a87.hot-update.json due to access control checks.
[Error] Unhandled Promise Rejection: Error: Manifest request to http://localhost:3000/app/themes/ssafd-theme/dist/2e1ebcbd6a2e8ebb9a87.hot-update.json timed out.
	(anonymous function) (main.js:40)
	promiseReactionJob

Has anyone seen anything like this before?

0 Likes

#2

Any thoughts? Don’t want this to get buried.

0 Likes

#3

What does your local development setup/server look like?

Is resources/assets/config.json configured properly?

0 Likes

#4

I’m running trellis/bedrock, on my Mac OS High Sierra 10.13.3 (17D102)

Here’s my resources/assets/config.json configuration:

{
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "publicPath": "/app/themes/ssafd-theme",
  "devUrl": "http://syracusesedationandfamilydentistry.test",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]
}

As far as I know it’s configured properly.

0 Likes

#5

Browsersync is running on port 3002 for you because something is already running on 3000

The proxyUrl isn’t currently able to detect when BS changes its port

Can you kill whatever is running on port 3000 and try again? fkill is good for this:

yarn global add fkill-cli
fkill :3000

Then try running yarn start again and seeing if it loads your BS session at http://localhost:3000 instead of http://localhost:3002

1 Like

Sage 9 browsersync not updating right
Browsersync stuck on reloading
My browsersync is gonna give me a seizure
#6

Could this be related?:

0 Likes

#7

Ran this, getting this as a result:

fkill :3000               ✔  1732  15:50:59

? Error killing process. Would you like to use the force? Yes
AggregateError:
    Error: Killing process 29683 failed: Process doesn't exist
        at Array.map (<anonymous>)
        at processExists.all.then.then (/Users/josephroberts/.config/yarn/global/node_modules/fkill/index.js:83:10)
        at <anonymous>
    at processExists.all.then.then (/Users/josephroberts/.config/yarn/global/node_modules/fkill/index.js:83:10)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

Unfortunately it’s not playing nice. Is there a way to see what’s possibly running on that port?

0 Likes

#8

You could just update proxyUrl to use a different port

0 Likes

#9

That worked, thanks Ben.

1 Like