Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.* introduces a bug in pathRewrite option #45

Open
ctrlaltdylan opened this issue Nov 15, 2021 · 1 comment
Open

1.1.* introduces a bug in pathRewrite option #45

ctrlaltdylan opened this issue Nov 15, 2021 · 1 comment
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ctrlaltdylan
Copy link

Hi,

I was using the old signature for pathRewrite of a plan object, with the key as the test pattern & the value being the replacement string.

This was working great with v1.0.* of the library, but it seems like the new v1.1.* introduce change broke this compatiblity.

httpProxyMiddleware(req, res, {
    target: `https://${shop.name}/admin/api/2021-10/graphql.json`,
    headers: {
      "Content-Type": "application/json",
      "X-Shopify-Access-Token": shop.accessToken,
    },
    changeOrigin: true,
    ws: true,
    pathRewrite: {
      "^/api/graphql": "",
    },
  });

I attempted to use the new Array based syntax:

    pathRewrite: [{
      patternStr: "^/api/graphql",
      replaceStr: ""
    }],
  });

But the without being able to visualize the request, I'm not sure why that request is being rejected by the host.

I just know that downgrading and keeping the old signature works for my case.

Leaving this for documentation purposes, maybe I'll get around to adding a debugging mode or something to view the request's parameters easier.

@stegano stegano self-assigned this Nov 17, 2021
@stegano
Copy link
Owner

stegano commented Nov 17, 2021

Hi @ctrlaltdylan

Thanks for your reporting 😀

I have a few questions to check this issue.

  • Can you tell me the URL value to input from the client and the URL value to convert?
    • If possible, would you like to download the source code from this repository, write a test case referring to the /index.test.ts file, and check if the URL is converted properly?
  • What response did you get from the server? (e.g. 404 response, pending status, etc..)

Thanks 😀

@stegano stegano added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants