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.

typescript-urql: utils.memoize1 is not a function

See original GitHub issue

Describe the bug I cannot add the latest versions to codesandbox yet, so I’ll leave what I have for now.

Using the newest packages gives me the following error:

node_modules/@graphql-codegen/plugin-helpers/index.js:500
const getCachedDocumentNodeFromSchema = utils.memoize1(utils.getDocumentNodeFromSchema);
  
TypeError: utils.memoize1 is not a function
    at Object.<anonymous> (node_modules/@graphql-codegen/plugin-helpers/index.js:500:47)

To Reproduce Use codegen with the packages below. Only happens on the latest packages so the schema should not matter.

Expected behavior Successful build

Environment:

  • OS: macOS 11.6
"@graphql-codegen/cli": "^2.2.1",
"@graphql-codegen/typescript": "^2.2.4",
"@graphql-codegen/typescript-operations": "^2.1.8",
"@graphql-codegen/typescript-urql": "^3.2.2"
  • NodeJS: v16.3.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
mattleffcommented, Oct 14, 2021

@ardatan Turns out it was my lockfile too…sorry for the noise! For anyone else try: npm --depth 10 update @graphql-tools/utils.

0reactions
capajcommented, Nov 2, 2021

I think this should be reopened. I got this today:

TypeError: utils.memoize1 is not a function
    at Object.<anonymous> (/home/capaj/work-repos/authier-repos/authier/node_modules/@graphql-codegen/plugin-helpers/index.js:502:47)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/capaj/work-repos/authier-repos/authier/node_modules/@graphql-codegen/cli/bin.js:29:23)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    

IN the file it imports memoize1 from here: https://github.com/ardatan/graphql-tools/blame/e7bb9810f8aa57e925ea5362e9f27b5d16d0e40f/packages/utils/src/memoize.ts#L1

this was added in version 8.4.0 I think, yet the version specified is ^8.1.1 in package.json.

Opened a PR for this here: #6957

Read more comments on GitHub >

github_iconTop Results From Across the Web

graphql-codegen/cli
GraphQL Code Generator. Live demo and full documentation: graphql-code-generator.com. Project repository: graphql-code-generator ...
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