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

When running savePresentation I get an error "Cannot access a closed Stream", and the file is copied successfully. #4

Open
itsikbelson-spotlight opened this issue Jan 14, 2024 · 11 comments

Comments

@itsikbelson-spotlight
Copy link

I'm using the following code to convert pptx to pdf (using integration with cloud storage).

   const slidesApi = new SlidesApi(
      '<APP_ID>'
      '<SECRET>'
   );

   const asposeStorage = '<STORAGE_NAME>';

   await slidesApi.savePresentation(
       basename,
       ExportFormat.Pdf,
       outPath,
       undefined,
       undefined,
       folder,
       asposeStorage
    );

The file conversion suceeds and is saved in the outPath.
However, the savePresentation call returns error:

{ message: 'Cannot access a closed Stream.', code: 500 }

I've tried to call the HTTP API directly using postman, and got a similar response:

{
    "requestId": "684c5ea3-2f99-4994-81cb-18c9c53f432e",
    "error": {
        "code": "internalError",
        "message": "Cannot access a closed Stream.",
        "description": "Operation Failed. Internal error.",
        "dateTime": "2024-01-14T10:57:36.4471327Z"
    }
}

How can it be resolved?

@andreypotapovaspose
Copy link

andreypotapovaspose commented Jan 18, 2024

@itsikbelson-spotlight,
Unfortunately, I was unable to reproduce the error you described. The savePresentation method works fine on our end. Could you please share the presentation file you used?

  • file name: itsik-test.pptx
  • folder path: dacHYDUidgPpUSWMOPnadMXZfYi1/doc/sources
  • storage: remote-assets-dev

@itsikbelson-spotlight
Copy link
Author

Sure. Attached.
Note that it happened with every other pptx I've tried.
itsik-test.pptx

@andreypotapovaspose
Copy link

@itsikbelson-spotlight,
I am still unable to reproduce the problem you are experiencing. I used the following code example:

slidesApi.savePresentation("itsik-test.pptx", "Pdf", "output.pdf").then(() => {
})
.catch(error => {
    console.error(error.message);
});

Could you please indicate the version of Node.js you are using?

@itsikbelson-spotlight
Copy link
Author

Sure. We're using node v18.

@andreypotapovaspose
Copy link

@itsikbelson-spotlight,
I checked the problem with Node.js 18. The savePresentation method works fine.

Note that it happened with every other pptx I've tried.

It looks like the issue is not related to Aspose.Slides for Node.js. You should check your environment.

@itsikbelson-spotlight
Copy link
Author

Thanks @andreypotapovaspose, but it also happened to me when using direct requests (using PostMan). In fact, the request id in the comment is the one taken with postman.

@andreypotapovaspose
Copy link

@itsikbelson-spotlight,
Thank you for the details. I am working on the issue and will get back to you soon.

@andreypotapovaspose
Copy link

@itsikbelson-spotlight,
Unfortunately, I was still unable to reproduce the error using Postman. We need more details to investigate the case.

@itsikbelson-spotlight
Copy link
Author

itsikbelson-spotlight commented Jan 19, 2024

LMK what more info is needed.
In the meantime, that's the curl request I ran in order to reproduce:
To get the token:

curl --location 'https://api.aspose.cloud/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=<CLIENT_ID>' \
--data-urlencode 'client_secret=<CLIENT_SECRET'

To do the conversion (this one returns 411):

curl -w '%{http_code}\n' --location --request PUT 'https://api.aspose.cloud/v3.0/slides/itsik-test.pptx/Pdf?outPath=dacHYDUidgPpUSWMOPnadMXZfYi1%2Fdoc%2Fitsik-test.pdf&folder=dacHYDUidgPpUSWMOPnadMXZfYi1%2Fdoc%2Fsources&storage=remote-assets-dev' \
--header 'x-aspose-client: nodejs sdk v23.11.0' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'

@andreypotapovaspose
Copy link

@andreypotapovaspose,
Please try the simplest request example first and check your results. I saved the "itsik-test.pptx" file to the root of the default storage and performed the request. It works fine. screenshot
I hope this will help you to isolate the problem.

@itsikbelson-spotlight
Copy link
Author

ok. thanks

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

2 participants