Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Is paperspace-node supposed to work in-browser? #15

Closed
TBBle opened this issue Aug 16, 2018 · 2 comments
Closed

Is paperspace-node supposed to work in-browser? #15

TBBle opened this issue Aug 16, 2018 · 2 comments

Comments

@TBBle
Copy link

TBBle commented Aug 16, 2018

Based on the Paperspace API docs

JavaScript API client (for Node.js and web browsers)

I expected that using the paperspace-node module (via ps_promise in my case) would work in a create-react-app-bootstrapped application.

However, I've hit a few problem, and they look suspiciously like assumptions of running on a node.js stack:

  • [lib/projectConfig.js] uses fs.existsSync which doesn't appear to be available.
  • [lib/method.js] uses readlineSync only when global.paperspace_cli is set, but always imports it.
  • [lib/jobs/create.js] uses archiver which eventually hits fs.ReadStream being missing.

isaacs/node-graceful-fs#121 (comment) suggests that last one might be a bug in graceful-fs, but perhaps it's a problem somewhere else.

Before I sink much more time into trying to fix these things properly, is this even a valid-use case? Is the 'web browsers' mention on the page an oversight, or is there something I need to fix about my environment to make this work?

@yulianovdey
Copy link

Just in case anyone stumbles upon this, it's very unlikely that this package was actually meant to be used in the browser in its current form. Your Paperspace API key should be kept secret, so be careful not to expose it in a client-side application.

@dte
Copy link
Member

dte commented Oct 30, 2018

That is correct. You should not expose your API key and this module is designed for server-side applications.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants