Type-GraphQL on Workers

I seem to be getting this error message when running
wrangler dev
and it fails to deploy:

✘ [ERROR] No matching export in "node-modules-polyfills:util" for import "promisify"

    node_modules/type-graphql/build/esm/helpers/filesystem.js:3:9:
      3 │ import { promisify } from "node:util";


wrangler.toml
:
node_compat = true
compatibility_date = "2023-10-30"
main = "src/index.ts"


tsconfig.json
:
{
  "compilerOptions": {
    "rootDirs": ["src"],
    "outDir": "dist",
    "lib": ["es2020"],
    "target": "es2021",
    "module": "es2022",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "types": ["node"],
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  }
}


webpack.config.ts:
const {resolve} = require("path");
module.exports = {
    entry: {
        'index': './src/index.ts'
    },
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
        ]
    },
    resolve: {
        extensions: ['.ts', '.js']
    },
    output: {
        filename: '[name].js',
        path: resolve(__dirname, 'dist')
    }
};


package.json
:
{
  "name": "graphql-server-2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "compile": "tsc",
    "start": "npm run compile && node ./dist/index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "module",
  "dependencies": {
    "@apollo/datasource-rest": "^6.2.2",
    "apollo-server-cloudflare": "^3.13.0",
    "graphql": "^16.8.1",
    "graphql-scalars": "^1.22.4",
    "promisify": "^0.0.3",
    "reflect-metadata": "^0.1.13",
    "type-graphql": "^2.0.0-beta.3"
  },
  "devDependencies": {
    "@types/node": "^20.9.4",
    "rollup-plugin-node-polyfills": "^0.2.1",
    "typescript": "^5.3.2"
  }
}
Was this page helpful?