Skip to content
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

Api fetch throws on undefined error.response #406

Open
pnodet opened this issue Apr 30, 2024 · 0 comments
Open

Api fetch throws on undefined error.response #406

pnodet opened this issue Apr 30, 2024 · 0 comments

Comments

@pnodet
Copy link

pnodet commented Apr 30, 2024

Current version in package.json:

"mangopay2-nodejs-sdk": "1.43.1",

Error message in production:

/app/node_modules/.pnpm/mangopay2-nodejs-sdk@1.43.1/node_modules/mangopay2-nodejs-sdk/lib/api.js:209
                        _.extend(error.response, {body: error.response.data}) : error.response.data;
                                                                                               ^
 TypeError: Cannot read properties of undefined (reading 'data')
    at /app/node_modules/.pnpm/mangopay2-nodejs-sdk@1.43.1/node_modules/mangopay2-nodejs-sdk/lib/api.js:209:96
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Stack trace points to line 209, in my local dev environnement it seems to be line 217 :

              // The request was made and the server responded with a status code
              // that falls out of the range of 2xx
              .catch(function (error) {
                  if (error.code === "ERR_CANCELED" && abortSignal.aborted) {
                      var err = {
                          Message: "Request timed out",
                          Code: 408
                      };
                      self.errorHandler(err.Message, err);
                      reject(err);
                  } else {
                      var resolveArgument = (resolveWithFullResponse) ?
                          _.extend(error.response, {body: error.response.data}) : error.response.data;

                      if (_.isFunction(callback)) {
                          callback(resolveArgument, error.response);
                      }

                      self.errorHandler(error.message, error.response.data);
                      reject(resolveArgument);
                  }
              });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant