-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TypeError: func is not a function #3256
Comments
same here... |
I can confirm that the problem also starts with |
@dauledk @evark Could you reproduce it using this codesandbox template? |
Hi @ardatan, to be honest, I don't know where to start - I am not very familiar with codesandbox. Given the link you provided me, how do I create an Angular project 🤷🏾♂️? |
@ardatan I tried reproducing this error, it's not easy but I finally found something! It seems like the error is not related to the setup (client or server) at all - but has something to do with versioning - maybe npm. When I removed the Only thing is that now, I can't reproduce 🤷🏾♂️ |
OK! after deleting node_modules/package-lock.json and reinstall everything codegen works normally. It seems that some dependency is not updated with the normal update of the package. Full reinstall is needed. |
In our case, the I just tried installing the latest version of pascal-case (v3.1.1) explicitly and it fixed the issue. |
it looks graphql-codegen has a dependency of "change-case": "^3.0.0", but change-case has dependency of "pascal-case": "^2.0.0", or wait for maintainers to update the dependency to "change-case": "^4.1.1" |
@ardatan is it fixed? |
@dotansimha We don't use |
I just installed @graphql-codegen/cli on an existing project and hit this error. I tried deleting package-lock but that did not fix the issue. Downgrading to |
this cause again in case using
not cause on once updated to '1.17.15' then even if I revert the version, the problem will continue to occur. |
my other plugins and changed dependencies. "devDependencies": {
"@graphql-codegen/cli": "^1.21.2",
"@graphql-codegen/typescript-operations": "1.17.14",
"@graphql-codegen/typescript-react-query": "^1.2.3",
} diff --git a/frontend/package.json b/frontend/package.json
index 05e7fbb..ffe7946 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -30,7 +30,7 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^1.21.2",
- "@graphql-codegen/typescript-operations": "1.17.14",
+ "@graphql-codegen/typescript-operations": "1.17.15",
"@graphql-codegen/typescript-react-query": "^1.2.3",
"@testing-library/react-hooks": "^5.1.0",
"@types/jest": "^26.0.20",
diff --git a/yarn.lock b/yarn.lock
index 7f8fd35..5572c16 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -834,14 +834,14 @@
lodash "~4.17.20"
tslib "~2.1.0"
-"@graphql-codegen/typescript-operations@1.17.14":
- version "1.17.14"
- resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-1.17.14.tgz#69b4bee4d66f2ea7e288f1be889e08946ef3452a"
- integrity sha512-jf1KnkA0i5hQNwc7bdMg5G6305DMSeTGDJSDoFryA2Tt9czWxY78m10/6GueUWo3zP6FIEhW1QRSve8ewTKEMg==
+"@graphql-codegen/typescript-operations@1.17.15":
+ version "1.17.15"
+ resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-1.17.15.tgz#c992e29ead1cf5c3f65dbbe1f522b09be30c36d6"
+ integrity sha512-HStWj3mUe+0ir2J0jqgjegrvcO1DIe2gzsoBBo9RHIYwyaxedUivxXvWY9XBfKpHv6sLa/ST1iYGeedrJELPtw==
dependencies:
- "@graphql-codegen/plugin-helpers" "^1.18.2"
- "@graphql-codegen/typescript" "^1.20.1"
- "@graphql-codegen/visitor-plugin-common" "^1.18.1"
+ "@graphql-codegen/plugin-helpers" "^1.18.3"
+ "@graphql-codegen/typescript" "^1.21.1"
+ "@graphql-codegen/visitor-plugin-common" "^1.19.0"
auto-bind "~4.0.0"
tslib "~2.1.0"
@@ -856,30 +856,14 @@
change-case-all "^1.0.12"
tslib "~2.1.0"
-"@graphql-codegen/typescript@^1.20.1":
- version "1.21.0"
- resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-1.21.0.tgz#301b1851cd278bedd1f49e1b3d654f4dc0af2943"
- integrity sha512-23YttnZ+87dA/3lbCvPKdsrpEOx142dCT9xSh6XkSeyCvn+vUtETN2MhamCYB87G7Nu2EcLDFKDZjgXH73f4fg==
- dependencies:
- "@graphql-codegen/plugin-helpers" "^1.18.2"
- "@graphql-codegen/visitor-plugin-common" "^1.18.3"
- auto-bind "~4.0.0"
- tslib "~2.1.0"
-
-"@graphql-codegen/visitor-plugin-common@^1.18.1", "@graphql-codegen/visitor-plugin-common@^1.18.3":
- version "1.18.3"
- resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-1.18.3.tgz#9d2c4449c3bdaffe3e782e2321fe0cb998b8a91d"
- integrity sha512-6xJzt8hszCTKt3rTlcCURpuiAFuaiaZgStlVeRE1OrKEDiY1T3vwF3/7TonhfnEjqBWtZdMmXvNx3ArXkRUV4w==
+"@graphql-codegen/typescript@^1.21.1":
+ version "1.21.1"
+ resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-1.21.1.tgz#9bce3254b8ef30a6bf64e57ba3991f9be7a19b53"
+ integrity sha512-JF6Vsu5HSv3dAoS2ca3PFLUN0qVxotex/+BgWw/6SKhtd83MUPnzJ/RU3lACg4vuNTCWeQSeGvg8x5qrw9Go9w==
dependencies:
- "@graphql-codegen/plugin-helpers" "^1.18.2"
- "@graphql-tools/optimize" "^1.0.1"
- "@graphql-tools/relay-operation-optimizer" "^6"
- array.prototype.flatmap "^1.2.4"
+ "@graphql-codegen/plugin-helpers" "^1.18.3"
+ "@graphql-codegen/visitor-plugin-common" "^1.19.0"
auto-bind "~4.0.0"
- dependency-graph "^0.10.0"
- graphql-tag "^2.11.0"
- parse-filepath "^1.0.2"
- pascal-case "^3.1.1"
tslib "~2.1.0"
"@graphql-codegen/visitor-plugin-common@^1.19.0":
@@ -4382,11 +4366,6 @@ depd@~1.1.2:
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=
-dependency-graph@^0.10.0:
- version "0.10.0"
- resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.10.0.tgz#dfebe384f1f36faf7782be203a7a71102a6335a6"
- integrity sha512-c9amUgpgxSi1bE5/sbLwcs5diLD0ygCQYmhfM5H1s5VH1mCsYkcmAL3CcNdv4kdSw6JuMoHeDGzLgj/gAXdWVg==
-
dependency-graph@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27" |
Hi, it "@graphql-codegen/visitor-plugin-common" which brakes with V 1.19.0. If you add this to you dep list it's working again: "@graphql-codegen/visitor-plugin-common": "1.18.3", |
seems exact package which causes issue is if you will explicitly lock it's version on |
thank you for reply. I thought the cause is even if I don't upgrade the version, here is the another module case I found .
will work, and
will not. my workaround: fix versions of the modules to be |
I suspect it might happen due I suspect that the change of |
Same situation here... I also think that problem is in yarn why v1.22.10
|
Codesandbox with the error: https://codesandbox.io/s/wispy-darkness-nxtp9 |
Today, until about 8 o'clock GMT, I set up typescript type generation, but after an hour everything just stopped working, I didn't change the versions. I perform the steps from the README and this error is returned 😕 |
We're aware of the issue and working on it. |
Could you all update all codegen packages to the latest version and try again? |
Work perfectly with the current versions. Thank you @ardatan "@graphql-codegen/cli": "1.21.3",
"@graphql-codegen/introspection": "1.18.1",
"@graphql-codegen/typescript": "1.21.1",
"@graphql-codegen/typescript-operations": "1.17.15",
"@graphql-codegen/typescript-react-apollo": "2.2.3", |
I sadly still experience the same issue.
|
@maxhaider Could you run |
It worked ! Thanks a ton ! @ardatan |
@ardatan After running yarn upgrade, the error disappeared.
|
Could you share |
I'm using a codegen.js file const dotenv = require('dotenv')
dotenv.config();
const apiSchema = {
[`${process.env.GRAPHQL_URL}`]: {},
}
const generateOptions = {
plugins: ["typescript", "typescript-operations", "typescript-react-apollo"],
config: {
skipTypename: false,
withHooks: true,
withHOC: false,
withComponent: false,
apolloReactHooksImportFrom: "@apollo/client",
},
}
module.exports = {
overwrite: true,
generates: {
[`${process.env.GRAPHQL_URL}`]: {
schema: apiSchema,
documents: ["./src/api/graphql/mutations/*.gql", "./src/api/graphql/queries/*.gql"],
...generateOptions,
},
},
} |
Your configuration seems wrong. Under const dotenv = require('dotenv')
dotenv.config();
const apiSchema= {
[`${process.env.GRAPHQL_URL}`]: {},
}
const generateOptions = {
plugins: ["typescript", "typescript-operations", "typescript-react-apollo"],
config: {
skipTypename: false,
withHooks: true,
withHOC: false,
withComponent: false,
apolloReactHooksImportFrom: "@apollo/client",
},
}
module.exports = {
overwrite: true,
generates: {
'output.tsx': { // This should be the name of the output file
schema: apiSchema,
documents: ["./src/api/graphql/mutations/*.gql", "./src/api/graphql/queries/*.gql"],
...generateOptions,
},
},
} Instead of using js file, I'd recommend to have YML file like below; schema: ${GRAPHQL_URL}
documents:
- ./src/api/graphql/mutations/*.gql
- ./src/api/graphql/queries/*.gql
generates:
output.tsx:
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
config:
skipTypename: false
withHooks: true
withHOC: false
withComponent: false
apolloReactHooksImportFrom: "@apollo/client" And you can run codegen with dotenv like this;
|
@ardatan thank you so much, you are the best! |
@ardatan It works perfectly too! thank you! |
When running
graphql-codegen
to generate typings, our team suddenly started to get this error today, after months of working without issues. I updated to latest version of all plugins, but the issue persists:Update - seems like the issue is only above version
1.9.1
.Expected behavior
Generated types
Environment:
codegen.yml
Workaround
Fix versions in your package.json:
"@graphql-codegen/cli": "1.9.1",
"@graphql-codegen/typescript": "1.9.1",
"@graphql-codegen/typescript-apollo-angular": "1.9.1",
"@graphql-codegen/typescript-operations": "1.9.1",
"@graphql-codegen/typescript-resolvers": "1.9.1",
The text was updated successfully, but these errors were encountered: