Giter VIP home page Giter VIP logo

Comments (11)

abiodunt97 avatar abiodunt97 commented on August 21, 2024 1

A huge thank you @lapa182. It now works for me perfectly. Thanks for all your help.

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

Hi @abiodunt97, thanks for reporting the issue! I see we documented how to integrate place suggestions endpoint, but unfortunately, we still didn't do the implementation on the SDK! I have raised the above to our team and will get back to you once it's implemented.

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

@abiodunt97 we just add the method on our latest version! Let me know if we can help further!

from duffel-api-javascript.

abiodunt97 avatar abiodunt97 commented on August 21, 2024

Thanks @lapa182, i've tried to implement it but i'm running into more issues.

Here is the error I get:

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\xxx\Desktop\xxx\app\xxx\server\node_modules\node-fetch\src\index.js from C:\Users\xxx\Desktop\xxx\app\xxx\server\node_modules\@duffel\api\dist\index.js not supported.
Instead change the require of C:\Users\xxx\Desktop\xxx\app\xxx\server\node_modules\node-fetch\src\index.js in C:\Users\xxx\Desktop\xxx\app\xxx\server\node_modules\@duffel\api\dist\index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\Users\xxx\Desktop\xxx\app\xxx\server\node_modules\@duffel\api\dist\index.js:1:75)
    at Object.<anonymous> (C:\Users\xxx\Desktop\xxx\app\xxx\server\src\routes\index.js:3:23)
    at Object.<anonymous> (C:\Users\xxx\Desktop\xxx\app\xxx\server\src\app.js:7:19)
    at Object.<anonymous> (C:\Users\xxx\Desktop\xxx\app\xxx\server\bin\www:31:11) {
  code: 'ERR_REQUIRE_ESM'
}

from duffel-api-javascript.

abiodunt97 avatar abiodunt97 commented on August 21, 2024

@lapa182

I managed to resolve the above by going into the index.js and changing the require('node-fetch') to import('node-fetch'), not sure why this version throws aan ERR_REQUIRE_ESM error.

Also, in this new version 1.13.0. I am getting the below error:

TypeError: i.default is not a function
    at $.<anonymous> (C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:7334) 
    at Generator.next (<anonymous>)
    at C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:809
    at new Promise (<anonymous>)
    at h (C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:554)
    at $.request (C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:6452)     
    at T.<anonymous> (C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:1775) 
    at Generator.next (<anonymous>)
    at C:\Users\xxx\Desktop\xxx\xxx\xxx\server\api\node_modules\@duffel\api\dist\index.js:1:809
    at new Promise (<anonymous>)

Please help.

from duffel-api-javascript.

abiodunt97 avatar abiodunt97 commented on August 21, 2024

@lapa182 Any news on this would be much appreciated, thanks.

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

Hi @abiodunt97, sorry I was off and wasn't able to help you before! Let me investigate the issue and will come back to you.

Regarding node-fetch, I have a feeling that's the version we use which is the newest node-fetch version which is built to be used as ESM.

Instead of manually updating to import('node-fetch') you can resolve the module and install the previous v2 version https://github.com/node-fetch/node-fetch#installation. Alternatively, you can compile the module on the framework settings you are using - Next.js for example allows you to transpile modules manually.

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

Hey @abiodunt97, I just investigate the issue and I think it's the issue it's caused by the change you made to node-fetch.

Could you please add to your package.json the following line:

If you are using npm:

"overrides": {
    "node-fetch": "2.6.7"
  },

If you are using yarn:

"resolutions": {
    "node-fetch": "2.6.7"
  },

And them re-install your packages.

from duffel-api-javascript.

abiodunt97 avatar abiodunt97 commented on August 21, 2024

No luck, still getting the same error with the overrides option added,

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

No luck, still getting the same error with the overrides option added,

Do you mean the ESM error or .default one? Also, could you say what node version are you using?

from duffel-api-javascript.

lapa182 avatar lapa182 commented on August 21, 2024

@abiodunt97 we deployed a new version of the library, could you please check if the issue still persists? Could you try deleting your node_modules and reinstalling the packages?

from duffel-api-javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.