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

Libs created from this template not working on browser #34

Open
duynguyen opened this issue Mar 22, 2023 · 7 comments
Open

Libs created from this template not working on browser #34

duynguyen opened this issue Mar 22, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@duynguyen
Copy link

duynguyen commented Mar 22, 2023

AIO SDK libs (e.g. aio-lib-analytics) created from this template can be used in Runtime actions. However, in some cases they should be used directly on the client side to fetch data from the backend service (little or no processing) without making a detour to the actions. Using those libs in the client JS code is yet not working.

Expected Behaviour

I should be able to use the libs in client side code (e.g. useEffect() in React).

Actual Behaviour

This error is printed out in browser console: TypeError: Swagger is not a constructor.

@shazron shazron added the bug Something isn't working label Mar 23, 2023
@shazron
Copy link
Member

shazron commented Mar 23, 2023

Just discovered the unit tests are not passing with [email protected] but pass on [email protected]. Can you try pinning swagger-client to 3.18.5 in your lib and see if it works? Still investigating the unit tests issue (see #35)

@shazron
Copy link
Member

shazron commented Mar 23, 2023

Scratch my instruction above, #35 has been resolved

@aiojbot
Copy link
Collaborator

aiojbot commented Mar 23, 2023

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-2137

@duynguyen
Copy link
Author

FWIW - the error message above happens to any SDK depending on [email protected] and earlier.

@shazron
Copy link
Member

shazron commented Mar 23, 2023

FWIW - the error message above happens to any SDK depending on [email protected] and earlier.

Do you mean also the error doesn't happen on [email protected] ?

@duynguyen
Copy link
Author

duynguyen commented Mar 23, 2023

Do you mean also the error doesn't happen on [email protected] ?

It does. I should have written "the error message above ALSO happens to any SDK depending on [email protected] and earlier".
However it's harder to reproduce on [email protected] because it gives a different error on Parcel [1].
When I used the SDK on [email protected] in a webpack powered websrc, I got the same error TypeError: Swagger is not a constructor.

[1] @parcel/core: Failed to resolve '@swagger-api/apidom-reference/configuration/empty'

@purplecabbage
Copy link
Member

This template is designed for nodejs use in a runtime action or in cli tooling. If you want a to generate web modules, I think that would be a new repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants