Experimental auth upgrade and bundling issue
NSeydoux opened this issue · 1 comments
For context, this issue is filed in order to investigate on an issue happening when upgrading @solid/react
to use an upgraded version of solid-auth-client
, which wraps @inrupt/solid-auth-fetcher
. Currently, the latest version of @inrupt/solid-auth-fetcher on NPM is 0.0.4, but 0.0.5 is ready to be released.
Dependencies overview
https://github.com/inrupt/react-components
├─┬─https://github.com/inrupt/solid-auth-client
│ └──@inrupt/solid-auth-fetcher
├─┬─https://github.com/inrupt/query-ldflex
├─┬─https://github.com/inrupt/LDflex-Comunica
│ └─┬─https://github.com/inrupt/actor-http-solid-auth-fetch
│ └──@inrupt/solid-auth-fetcher
└──@inrupt/solid-auth-fetcher
Description of the issue
0.0.5 fixes a bundler issue with solid-auth-fetcher, but it seems that @solid/react (https://github.com/inrupt/react-components)
has a specific bundler setup that doesn't work with the latest fix for @solid-auth-fetcher. More specifically, it looks like
LDflex has issues with the bundled version of the solid-auth-client fork that wraps solid-auth-fetcher.
To reproduce
- clone git@github.com:inrupt/react-components.git, and checkout branch feature/experimental-auth-upgrade
- If @inrupt/solid-auth-fetcher@0.0.5 is not on NPM, clone git@github.com:inrupt/solid-auth-fetcher.git and checkout branch fix/webpack-export-1003. Run
npm run build
- Make sure that the @solid/react dependencies to @inrupt/solid-auth-fetcher resolve to the local version of solid-auth-fetcher, e.g. using verdaccio
- In react-components
npm run build
npm run start
- Open http://localhost:8080/ in a browser
- The last line should read "Solid React demo app by i.fetch is not a function"
- There are errors in the console
Additional experiments
If the following
useEffect(() => {
console.log("coucou")
fetch('http://localhost:8080/')
.then(response => response.text())
.then(data => {
console.log(data);
});
});
is added under export default function App() {
, and import {fetch} from 'solid-auth-client';
is added at the top of the file, the console shows that the fetch worked,
which tends to prove the issue is in the interaction between solid-auth-fetcher and LDflex rather than in the solid-auth-client wrapper.
However, all three LDflex forks show all their tests passing, so it seems to indicate an issue when @solid/react is bundled, rather than a core issue between solid-auth-fetcher and LDflex.
The problem is that @inrupt/solid-react-components use @solid/react, so the current issue blocks upgrading @inrupt/solid-react-components to use @inrupt/solid-auth-fetcher and interact with a backend supporting the new token.
Are there specificities to the way LDflex is bundled/resolves dependencies that we should be aware of ?
The issue was in fact due to a bundling problem that we thought was solved in @inrupt/solid-auth-fetcher@0.0.5, but was in fact only resolved in v0.0.6.