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

Test against future breakage of worker integrations and other non-node environments #7369

Open
trevor-scheer opened this issue Feb 8, 2023 · 1 comment

Comments

@trevor-scheer
Copy link
Member

Some environments aren't compatible with certain Node APIs, but we'd like Apollo Server to be compatible with them and not accidentally break them in future releases. We should implement some kind of test to ensure that we don't break these integrations.

Ref: #6034 (comment)

@trevor-scheer trevor-scheer changed the title Test against future breakage of worker integrations Test against future breakage of worker integrations and other non-node environments Feb 8, 2023
@trevor-scheer
Copy link
Member Author

Looks like CFW's wrangler CLI is very capable of helping out here. We could pretty easily add a CI step which utilizes it. Ran this locally and the output is great!
npx wrangler publish --name=dont-care --dry-run --outdir=. --compatibility-date=2023-02-23 packages/server/dist/esm/index.js

✘ [ERROR] Could not resolve "crypto"

    node_modules/@apollo/utils.createhash/dist/index.js:7:30:
      7 │         return module.require("crypto").createHash(kind);
        ╵                               ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "os"

    packages/server/dist/esm/plugin/schemaReporting/index.js:1:15:
      1 │ import os from 'os';
        ╵                ~~~~

  The package "os" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "os"

    packages/server/dist/esm/plugin/usageReporting/plugin.js:7:15:
      7 │ import os from 'os';
        ╵                ~~~~

  The package "os" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "zlib"

    packages/server/dist/esm/plugin/usageReporting/plugin.js:8:21:
      8 │ import { gzip } from 'zlib';
        ╵                      ~~~~~~

  The package "zlib" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Build failed with 4 errors:

  node_modules/@apollo/utils.createhash/dist/index.js:7:30: ERROR: Could not
  resolve "crypto"
  packages/server/dist/esm/plugin/schemaReporting/index.js:1:15: ERROR: Could
  not resolve "os"
  packages/server/dist/esm/plugin/usageReporting/plugin.js:7:15: ERROR: Could
  not resolve "os"
  packages/server/dist/esm/plugin/usageReporting/plugin.js:8:21: ERROR: Could
  not resolve "zlib"

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

No branches or pull requests

1 participant