adobe / adobe/aio-lib-template

Libs created from this template not working on browser

Open
#34 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4
Forks
3
PR merge metrics
No merged PRs in 30d

Description

AIO SDK libs (e.g. [aio-lib-analytics](https://github.com/adobe/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`.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Swagger constructor error when an AIO SDK library is imported from client-side JavaScript, such as a React useEffect(). Inspect the template's generated library and browser-facing dependency handling. Done means libraries created from the template can fetch backend data directly in browser code without the Swagger constructor error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.