Comments (11)
A huge thank you @lapa182. It now works for me perfectly. Thanks for all your help.
from duffel-api-javascript.
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.
@abiodunt97 we just add the method on our latest version! Let me know if we can help further!
from duffel-api-javascript.
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.
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.
@lapa182 Any news on this would be much appreciated, thanks.
from duffel-api-javascript.
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.
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.
No luck, still getting the same error with the overrides option added,
from duffel-api-javascript.
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.
@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)
- Dependency Dashboard
- CardPayment Component HOT 9
- slack test issue
- Suggestion: Get flight fare rules using fare basis code HOT 2
- Rate Limiting HOT 4
- Create Duffel App HOT 1
- `max_connections` is missing from type `CreateOfferRequest` HOT 1
- Should `OfferRequestSlice` `origin` and `destination` be type `Place`? HOT 2
- `OfferPassenger`` type` should be `DuffelPassengerType` not `string` HOT 1
- Missing key in OfferSliceSegment type HOT 2
- return_offers question HOT 2
- Undefined booking response, no errors returned HOT 18
- Selected service ID is not the valid one when reaching orders.create() HOT 3
- Reporting a vulnerability HOT 1
- Typescript Types are not aligned with API docs HOT 2
- Version 2.5.2 : Cannot find module 'Client' or its corresponding type declarations HOT 3
- Version 2.5.3: Cannot find module 'types' or its corresponding type declarations. HOT 4
- Type mismatch between documentation and Typescript types HOT 2
- import{URL as s,URLSearchParams as e}from"url" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duffel-api-javascript.