Big Assist from Warp AI Today

Note: I have no affiliation with Warp.

This is with regard to the Warp terminal app. It runs on Mac and has just been released for Windows.

I was having a lot of questions wrt updating graphql-ws from v5 to v6. The docs say the new import statement should be:

import { useServer } from 'graphql-ws/use/ws';

…but that was throwing:

“Cannot find module ‘graphql-ws/use/ws’”

Warp uses Claude AI, with the advantage that, since it’s the terminal app, in can inspect files and file paths if you give it permission.

I asked why I was getting that error on that import statement. Here’s what it came back with:

Would you like me to check your package.json and tsconfig.json configurations?

> yes

Let me check both your package.json and tsconfig.json to verify the module configuration settings.

I see the issue now. You’re using a Meteor project (based on the “meteor run” script and dependencies), and Meteor has its own module system and build configuration.

For Meteor projects using GraphQL WebSocket subscriptions, you should use a different import path. Try this instead:

import { useServer } from ‘graphql-ws/dist/use/ws’;

This should work because:

  1. Meteor doesn’t use Node.js’s native ES modules system by default
  2. The’graphql-ws package’s dist directory contains the compiled JavaScrint that’s more compatible with Meteor’s module system

It worked. :grinning:

Check that your app will run after creating a production build

1 Like

Interesting. That’s good to see AI supports Meteor.
Btw, I use this import instead:

import { useServer } from "graphql-ws/lib/use/ws";

Meteor 3 and it works on both dev and prod build.

Interesting! Thanks for the warning. Is there an alternate import statement you recommend?

That’s what I used with graphql-ws version 5, but it doesn’t appear to work with version 6.

What version of graphql-ws are you currently using?

It’s version 5. I haven’t tried v6 yet.

I’ll see if my import statement works in production. First I’ll test here with the --production flag set. I’ll report back what I find out.

1 Like

It looks like they are now focusing on other package named graphql-sse which includes codes for both client and server.

For information purposes only, who is “they” in that sentence?

I mean “he”. I’m not sure just because the github link from website points to that repo.

Just so I make sure I’m following correctly, what website is that?

It is https://the-guild.dev/graphql/ws.


I followed that GitHub link, but I could be wrong. graphql-sse and graphql-ws are two packages, they use different protocols web socket and Server-Sent Events. I wonder what’s the different in area of performance. graphql-sse might require less CPU/Ram compare to graphql-ws.
Edit: There is a performance test here: https://www.timeplus.com/post/websocket-vs-sse. They are very close. So I guess we’ll choose the one which is easier to set up.

That makes sense. I hope to continue with the new version of graphql-ws.

1 Like