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

Javascript error, module not found #107

Closed
rnnyrk opened this issue Mar 26, 2019 · 6 comments
Closed

Javascript error, module not found #107

rnnyrk opened this issue Mar 26, 2019 · 6 comments

Comments

@rnnyrk
Copy link

rnnyrk commented Mar 26, 2019

I want to start using the Abastract API but after using it in my project I get the following error:

Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '/Users/developer/review-tracker-2019/node_modules/abstract-sdk/lib'

I googled the issue and solutions like installing core-js doesn't seem to work. Any idea on how tho fix this? Using the latest Abstract verison 1.0.0-beta.11.

@rnnyrk
Copy link
Author

rnnyrk commented Mar 26, 2019

I've fixed this issue by manually installing the packages "core-js": "2.5.7", & "@babel/runtime-corejs2": "7.4.2",, but now I'm having a CORS error;

Access to fetch at 'https://api.goabstract.com/projects?' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I'm using the client this way:

import * as AbstractSDK from 'abstract-sdk';

const client = new AbstractSDK.Client({
  accessToken: 'TOKEN',
});

Can't find an option to add localhost as origin host, or any documentation about this.
Any suggestion?

@bitpshr
Copy link
Contributor

bitpshr commented Mar 26, 2019

Hi @rnnyrk, thanks for reaching out. Both our stable 0.x.x release line and our beta 1.0.0-beta.x release line bring in @babel/runtime-corejs2 as dependencies that are installed alongside abstract-sdk. This means that you shouldn't have to install @babel/runtime or core-js manually in your project.

Do you have a reduced test case or minimal test project that demonstrates the issue you're encountering? Also, what version of NPM are you using? I'd be happy to take a look.

@rnnyrk
Copy link
Author

rnnyrk commented Mar 26, 2019

Hi @bitpshr. In my package-lock.json I saw the reference to the @babel/runtime-corejs2, so I decided to manually install it. I don't know why it isn't installed, but that issue is fixed by installing those. Any tips on fixing the CORS issue?

My NPM version is 6.4.1

@bitpshr
Copy link
Contributor

bitpshr commented Mar 26, 2019

@rnnyrk: Thanks for the added context. It sounds like @babel/runtime-corejs2 failed to install despite being listed as a dependency and ending up in your lockfile, so your manual installation kicked those dependencies into place. If you continue to see this issue during clean NPM installations, please let us know, as this definitely shouldn't be required.

As for the CORS issue, while our SDK will work in both the browser and Node from a JavaScript perspective, the backing API that the SDK uses (located at https://api.goabstract.com) still has CORS enabled and can't be accessed by external domains at this time. Opening this endpoint up to all domains is at the top of our priority list and we're actively working to make this happen.

For now, the best way to experiment with the SDK is in a Node environment. Don't hesitate to let us know if you encounter additional issues or have any additional questions.

@rnnyrk
Copy link
Author

rnnyrk commented Mar 26, 2019

Cool. I hope to use this as soon as possible. I think it will open a loot of doors for cool Javascript based Abstract plugins. Can I somehow get notified when it's possible to use all domains?

@bitpshr
Copy link
Contributor

bitpshr commented Apr 2, 2019

Hi @rnnyrk. You can follow #110 to be notified when CORS support lands. Thanks again for bringing this to our attention and for testing the beta version of the SDK.

@bitpshr bitpshr closed this as completed Apr 2, 2019
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