question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rest Api from Cubejs gets mistaken as GraphQL when using both in one handler

See original GitHub issue

Prerequisites

Environment check

  • I’m using the latest msw version
  • I’m using Node.js version 14 or higher

Node.js version

14.17.5

Reproduction repository

https://github.com/brantleyenglish/msw-test

Reproduction steps

Run yarn then yarn test

Current behavior

Currently I am getting this error, and the mocked rest endpoint does not get populated with mock data.

console.error
[MSW] Failed to intercept a GraphQL request to "GET https://azure-bonobo.aws-us-west-2.cubecloudapp.dev/cubejs-api/v1/load": cannot parse query. 
See the error message from the parser below.
Syntax Error: Expected Name, found String "measures".

This url should be parsed as a rest endpoint. This is not a graphql query.

Expected behavior

I expect the test to pass the resultSet to return some form of data.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brantleyenglishcommented, Apr 6, 2022

Wow, this is very cool 😮 !! Thank you for taking a look into my issue and suggesting the improvement.

1reaction
kettanaitocommented, Apr 4, 2022

Hey, @brantleyenglish. Thanks for reporting this!

I’ve posted an update on the way to tell apart GraphQL requests reliably here: https://github.com/mswjs/msw/discussions/535#discussioncomment-2504052

This really moves the discussion (and the correct solution to this issue) to the GraphQL community. I’d stay in the loop to see how I can help. I’d love to merge a fix for this in a form of relying on the application/graphql+json content type header.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL API | Cube Docs
Getting started. The Cube GraphQL API does not currently support using variables from a GraphQL client. Instead inline variables directly in the query....
Read more >
Welcome to Everything.js | Everything.js
Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API. ... for the modern web. graphql/graphql-js - A reference implementation of GraphQL...
Read more >
Data Visualization Dashboard using Vue.js, Cube.js ... - Morioh
js and Cube, a Headless BI and analytics APIs for building data applications. You'll also learn how you can use Apache ECharts, an...
Read more >
CVE - Search Results - MITRE
An attacker can take advantage of this by using an HTTP GET request to perform actions ... In the HTTP Handler API, the...
Read more >
Security Bulletin 14 Dec 2022
CVE Number Base Score Reference CVE‑2021‑29472 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑29472 CVE‑2021‑32765 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑32765 CVE‑2021‑39317 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑39317
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found