Closed matheusrocha89 closed 5 months ago
Hey , what version of the package and node are you using ?
I am using the: 22.6.1 version of pipedrive client and node version 18.18.0
Hey, @matheusrocha89!
Maybe you can share a bit more insights about your project's setup?
I created a simple nextjs project based on the tutorial and I was able to use the SDK v22.6.1 with Node 18.18.0, I didn't bump into the issue that you are having.
Hi @siirimangus I create a new repository and tried to use and got the same error. Here is the repository link https://github.com/matheusrocha89/pipedrive-example
The error is related to the Formidable package which is inherited by the superagent package.
I'm using the same versions as @matheusrocha89:
"next": "14.2.3",
"pipedrive": "^22.8.0",
References: https://github.com/auth0/node-auth0/issues/798 https://github.com/pubnub/javascript/issues/352
I adapted the solution from the last link and the error disappeared:
next.config.mjs
import path from 'path';
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer }) => {
config.resolve.alias['hexoid'] = path.resolve('node_modules/hexoid/dist/index.js');
return config;
}
};
export default nextConfig;
@rphm , thank you so much for the insights!
I tried this solution on the provided project https://github.com/matheusrocha89/pipedrive-example and it worked, the error disappeared.
One thing, though, I wasn't able to use the import
statement for pipedrive
package, had to use require
. Is it the same for you as well @matheusrocha89?
Another thing I'm going to try out now is, to bump the superagent
version to 9 in the pipedrive
package in order to see whether it will resolve the issue with formidable
as well. As the issue seems to be with superagent
7, but not, for example, with superagent
6 as suggested in this comment: https://github.com/auth0/node-auth0/issues/798#issuecomment-1493858162
@siirimangus I could make it work using
import * as pipedrive from "pipedrive";
I had to do that because there was no export default so I imported everything and named it as pipedrive
doing that.
Off-topic question: Do we have support for typescript types or it's in the roadmap to be created? Because I had to declare a module in this example so typescript not complain about not having type definitions for the lib.
@rphm in your solution you are destructing the { isServer }
but you are not using it, you were planning to use it and didn't write or you just forgot the variable there? Just wanna understand if you would use it to change the resolve alias if it was server-side.
sorry, forgot to remove that, has nothing to do with the solution:
next.config.mjs
import path from 'path';
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.resolve.alias['hexoid'] = path.resolve('node_modules/hexoid/dist/index.js');
return config;
}
};
export default nextConfig;
Off-topic question: Do we have support for typescript types or it's in the roadmap to be created? Because I had to declare a module in this example so typescript not complain about not having type definitions for the lib.
Typescript support is in the roadmap. Currently it is in the rc status: https://www.npmjs.com/package/pipedrive/v/22.3.1-rc.5
Another thing I'm going to try out now is, to bump the superagent version to 9 in the pipedrive package in order to see whether it will resolve the issue with formidable as well. As the issue seems to be with superagent 7, but not, for example, with superagent 6 as suggested in this comment: https://github.com/auth0/node-auth0/issues/798#issuecomment-1493858162
Sadly the same issue persists with superagent
v9 which uses formidable
v3.
So I guess the suggested solution is the way to go here.
I am trying to use the client node with a nextjs project and when I am importing the pipedrive I am getting this error:
Anybody already passed through this?