parcel: Proxy doesn't appear to be running/working on 2.0, Mac OSX 12.0.1

πŸ› bug report

In an attempt to run the devserver + proxy, it seems the proxy isn’t running? Or at least not functioning as expected?

I followed the instructions at https://parceljs.org/features/development/ and it seems to me that this rule should proxy . As authored it works on a linux OS, but not on my mac os x machine.

πŸŽ› Configuration (.babelrc, package.json, cli command)

.proxyrc

{
  "/api": {
    "target": "http://localhost:8080/"
  }
}

πŸ€” Expected Behavior

http://localhost:1234/api -> http://localhost:8080/api
curl http://localhost:1234/api/endpoints

{ "some":  "json content served at http://localhost:8080/api/endpoints"}

😯 Current Behavior

the call currently returns the contents of http://localhost:1234.

I also used a linux machine I have, same node, npm, parcel versions. The proxy appears to be working on that machine, this may be OS X specific.

Software Version(s)
Parcel 2.0.0 and 2.0.1
Node 16.13.0
npm/Yarn 8.1.0
Operating System Mac OS X v12.0.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (7 by maintainers)

Most upvoted comments

I am seeing something like this in a project with Yarn/npm workspaces. I am using Parcel in only one workspace (so far) but it was installed by Yarn in the root node_modules folder.

On a hunch (off of @mischnic’s comment about global vs. local), I tried moving the .proxyrc file to the root next to the node_modules where it is installed, and now the proxy is working as expected.

You need to do curl http://localhost:1234/api/data to request this file: https://github.com/mischnic/parcel-issue-7257/blob/master/api/data