Moving app to another IP address and getting invalid client error

I am in the process of moving our test version of an app to new server with a different IP address, for performance concerns. However when testing it, I am now receiving an error that the client is invalid.

@PeopleProdDev

Can you please share some more details of the issue to reproduce/investigate it? Please also share error details/screenshots as well.

Sure, I am developing an app that merges ppts in node.js. This does work from an older server that I have set up, but fails on the new server. During the uploading of the files to be merged the fileAPI.uploadFile() is returning undefined, and the during the merge the the join request is throwing an error with error.message: invalid_client.

Here are some snippets:

const uploadFiles = async (files, userID, next) => {
let fileApi = groupdocs_merger_cloud.FileApi.fromConfig(config);
  // construct FileApi
  await Promise.all(
    files.map(
      async (file) =>
        // read files one by one
        await new Promise((resolve, reject) =>
          fs.readFile(path.join(__dirname, `../Users/${userID}/${file.assetId}/${file.assetId}.pptx`),
            async (err, fileStream) => {
              if(err){
                console.log(err)
                next(err)
              } else {

                // create upload file request
                console.log("forming request");
               
                  let request = new groupdocs_merger_cloud.UploadFileRequest(
                    "/sutherlandTest/" + file.assetId + ".pptx",
                    fileStream,
                    myStorage
                    );
                    // upload file
                    console.log("request ", request);
                    try {
                      let response = await fileApi.uploadFile(request);
                      console.log(file.assetId + " file uploaded: " + response.uploaded.length);
                      
                    } catch (error) {
                      // throw error.message;
                      next(error)
                    }
                   resolve()
                  }

       
            }
          )
        )
    )
  );
  await mergeSlides(files, userID)
 
};
const mergeSlides = async (selectedPPTS, userID) => {
  console.log("in merge");

  let documentApi = groupdocs_merger_cloud.DocumentApi.fromKeys(
    clientId,
    clientSecret
  );

  let joinItems = selectedPPTS.map((ppt) => {
    let joinItem = new groupdocs_merger_cloud.JoinItem();
    joinItem.fileInfo = new groupdocs_merger_cloud.FileInfo();
    joinItem.fileInfo.filePath = `sutherlandTest/${ppt.assetId}.pptx`;
    joinItem.pages = ppt.pages;
    console.log("joinItem: ", joinItem);
    return joinItem;
  });

  let options = new groupdocs_merger_cloud.JoinOptions();
  console.log("Join Items", joinItems);
  options.joinItems = joinItems;
  options.outputPath = `sutherlandTest/${userID}collatedFile.pptx`;

  try {
    // Create join documents request
    let joinRequest = new groupdocs_merger_cloud.JoinRequest(options);
    let result = await documentApi.join(joinRequest);
    console.log("join result: ", result);
  
  } catch (err) {
    throw err.message;
  }
};

and a screen shot of the logs:Screenshot 2023-06-09 at 9.46.42 AM.png (119.3 KB)

Thank you,

If the requests are working fine on your older server but failing on the new server, then please double check that you have changed your URI on the new server accordingly. Please also compare both servers settings; it will help you find the root cause of the problem.

What change to the URI would be needed? They are both pointing the API calls to the same app.

@PeopleProdDev

I am sorry for the confusion. I think in your last query you were asking for the Docker container. However, in reference to the GroupDocs hosted solution of GroupDocs.Merger Cloud API, recently we have noticed a token refresh issue that is fixed in the latest version of the SDK. So please update your GroupDocs.Meger Cloud SDK for Node.js, it will resolve the issue.

Hey Tilal, I think there. is still some confusion. I don’t believe this related to either of my previous tickets, other than it is the same project. I had resolved the refresh token issue, first by reinstantiating the session in each function call, and then by updating the SDK. And the discussion about Docker was to explore ways to save costs on the Storage API. This is an issue where when testing the same application from a different EC2 instance and different IP address, the calls to the groupdocs API do not seem to go through.

I appreciate your help in this issue, I have resolved it, there was a user error on my part. I had a leading whitespace in a part of the config on the new server.

@PeopleProdDev

Thanks for sharing the details. We will check and update and you soon.