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

v8.11.0 UnhandledSchemeError when bundling with Webpack #2975

Closed
andrew-pledge-io opened this issue May 16, 2023 · 8 comments · Fixed by #2978
Closed

v8.11.0 UnhandledSchemeError when bundling with Webpack #2975

andrew-pledge-io opened this issue May 16, 2023 · 8 comments · Fixed by #2978

Comments

@andrew-pledge-io
Copy link

This line introduced in this PR is causing errors in Webpack builds.

Webpack compilation failed:
in cloudflare:sockets
  Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
  Webpack supports "data:" and "file:" URIs by default.
  You may need an additional plugin to handle "cloudflare:" URIs.

This occurred after a minor update to the pg package from v8.10.0 to v8.11.0 when the pg-cloudflare package was added as an optional dependency.

For now, we've reverted to v8.10.0.

I expect this will affect a lot of people using Webpack as they start to update.

@andrew-pledge-io andrew-pledge-io changed the title v8.11.0 UnhandledSchemeError build error when bundling with Webpack v8.11.0 UnhandledSchemeError when bundling with Webpack May 16, 2023
@elithrar
Copy link

cc @petebacondarwin

@irvinebroque
Copy link
Contributor

@andrew-pledge-io — which version of Webpack are you using, where you hit this error?

I think this relates back to webpack/webpack#15741 — and declaring cloudflare:sockets as an external in Webpack may help?

@petebacondarwin
Copy link
Collaborator

petebacondarwin commented May 16, 2023

Here is a minimal webpack setup that should work with the latest version:

const path = require("path");
const webpack = require("webpack");

module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "main.js",
    path: path.resolve(__dirname, "dist"),
  },
  target: "node",
  mode: "development",
  plugins: [
    new webpack.IgnorePlugin({
      resourceRegExp: /^pg-native$|^cloudflare:sockets$/,
    }),
  ],
};

Note that we are ignoring both the pg-native and cloudflare:sockets imports since they are not needed here.

@petebacondarwin
Copy link
Collaborator

I put together a PR that I think should make this just work "out of the box" for everyday users of pg. See #2978.

@ravdeep-carechain
Copy link

Getting same error :)

@sondr3
Copy link

sondr3 commented May 22, 2023

This also fails for me when using Kysely together with NextJS, had to revert to 8.10 as well.

colecu added a commit to nsidc/cumulus that referenced this issue Jun 7, 2023
There is currently an issue with version 8.11 that causes webpack
failures. See brianc/node-postgres#2975.
@Harsh2509
Copy link

Ahm, I am using postgres server from docker image and getting same error. Isn't is solved yet?

@RomanDenysov
Copy link

@andrew-pledge-io

It helps me:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants