Troubleshooting Common Issues
Solutions to common problems encountered when developing widgets on the INVENT platform.
Table of Contents
- Development Environment
- Widget Creation
- Local Development
- Module Federation
- API Integration
- Authentication
- Deployment
- Performance
Development Environment
NPM Install Fails
Problem: npm install fails with authentication error
Solution:
- Verify NPM token is configured:
cat ~/.npmrc
- Ensure token has
read_apiaccess - Check token hasn't expired in GitLab
- Reconfigure if needed:
npm config set --location=user @invent:registry=https://gitlab.apptrium.io/api/v4/packages/npm/npm config set --location=user //gitlab.apptrium.io/api/v4/packages/npm/:_authToken=YOUR_TOKEN
See: Prerequisites → NPM Configuration
Node Version Mismatch
Problem: Build fails with Node.js version error
Solution:
-
Check required Node version:
node --version -
Install Node 20 (LTS):
# macOSbrew install node@20# Or use nvmnvm install 20nvm use 20 -
Verify version:
node --version # Should show v20.x.x
Widget Creation
Port Already in Use
Problem: npm run dev fails - port already in use
Solution:
- Find process using the port:
lsof -i :5XXX # Replace XXX with your port number
- Kill the process:
kill -9 <PID>
- Or use a different port temporarily by modifying package.json
Note: Widget ports follow format 5{GitLab Project ID} - don't change permanently
Widget Config Validation Fails
Problem: widget-config.json has validation errors
Common Issues:
- Port doesn't match GitLab Project ID
- widgetType is not 0, 1, or 2
- Missing required fields
Solution:
- Verify port =
5{GitLab Project ID} - Check widgetType enum:
0= Platform widget1= Dashboard widget (most common)2= Universal widget
- Validate JSON syntax:
cat widget-config.json | python -m json.tool
See: Widget Config
Local Development
Widget Not Loading in Browser
Problem: npm run dev succeeds but widget doesn't load
Checklist:
- Verify dev server is running:
# Should see "Compiled successfully"
- Check correct port in browser URL:
http://localhost:5XXX # XXX = your project ID
- Clear browser cache (Cmd+Shift+R / Ctrl+Shift+R)
- Check browser console for errors
- Verify
src/main.tsxexists and is correct
Hot Module Replacement Not Working
Problem: Changes don't reflect without full reload
Solution:
- Ensure webpack dev server is running (
npm run devornpm run start_federation) - Check no syntax errors in console
- Try restarting dev server
- For styled-components changes, full reload may be needed
Cannot Connect to Portal
Problem: Local widget doesn't load in portal when using dev-version
Solution:
-
Verify widget is set to
dev-versionin ICP:- Open ICP → Micro Apps Versioning
- Find your widget
- Click cog icon → Select "dev-version"
- Click Apply
-
Ensure
npm run start_federationis running (notnpm run dev) -
Check CORS/network errors in browser console
-
Verify you're running on correct port (5[Project ID])
See: Development Workflow → Connecting to Portal
Module Federation
Shared Dependency Version Conflict
Problem: Widget fails to load - shared dependency version mismatch
Error Example:
Shared module is not available for eager consumption
Solution:
- Check @invent/webpack-config version
- Update to match host application:
npm update @invent/webpack-config
- Ensure React version matches platform:
{"react": "^18.0.0","react-dom": "^18.0.0"}
- Clear node_modules and reinstall:
rm -rf node_modules package-lock.jsonnpm install
remoteEntry.js Not Found
Problem: Widget fails to load - 404 on remoteEntry.js
Solution:
- Verify widget is deployed to Widget Store
- Check widget version in ICP matches deployed version
- Clear browser cache
- For local development, ensure
npm run start_federationis running
API Integration
httpClient Returns 401 Unauthorized
Problem: API calls fail with authentication error
Checklist:
- User is logged in to portal
- JWT token is valid (not expired)
- API endpoint requires authentication
- User has correct permissions
For OAuth APIs:
- Verify ProxyApp is configured correctly
- Check user has completed OAuth flow
- Ensure token refresh is working
See: API Integration
CORS Error
Problem: API call blocked by CORS policy
Solution:
- Not a Widget Issue - CORS must be configured on API server
- Use httpClient (includes proxy through BfF)
- Contact backend team to configure CORS headers
- For local development, use BfF proxy
Authentication
ProxyLogin Not Showing
Problem: ProxyLogin component doesn't render
Checklist:
- ProxyApp wraps your component
- Provider name matches configuration
- authUrl is correct
- User hasn't completed OAuth already
See: ProxyLogin Tutorial
OAuth Token Expired
Problem: API calls fail after some time
Solution:
- Implement token refresh in ProxyApp
- Use
useAuthhook to check auth status - Handle refresh token logic
- Show re-auth UI when needed
Deployment
Semantic Release Not Triggering
Problem: Merge request merged but no version released
Checklist:
- MR title has semantic prefix:
feat:,fix:,docs:, etc. - Merged to master/main branch
- CI pipeline completed successfully
- Check GitLab CI/CD logs for errors
See: Semantic Release
Widget Not Appearing in Portal
Problem: Widget deployed but doesn't show in Micro App Library
Solution:
-
Verify first release completed:
- Check GitLab tags for version tag
- Check Widget Store has widget entry
-
Contact INVENT technical manager to:
- Register widget in portal
- Configure widget metadata
- Add widget to portal's widget list
-
Check context rules in widget-config.json:
- May be filtered by current dashboard context
- Verify contextRules configuration
See: Widget Publishing
Pipeline Fails on Build
Problem: GitLab CI pipeline fails during build step
Common Causes:
- Linting Errors - Run
npm run lintlocally - Test Failures - Run
npm testlocally - Type Errors - Run
npm run buildlocally - Missing Dependencies - Check package.json
Solution:
- Fix errors locally first
- Ensure all tests pass
- Commit fixes and push again
Performance
Widget Loads Slowly
Problem: Widget takes long time to load
Solutions:
-
Reduce Bundle Size
npm run analyze- Remove unused dependencies
- Use code splitting for large components
- Lazy load heavy features
-
Optimize Images
- Use SVG for icons
- Compress images
- Lazy load images
-
Minimize Re-renders
- Use React.memo for expensive components
- Optimize useEffect dependencies
- Use useMemo for expensive calculations
See: Module Federation → Best Practices
Memory Leak
Problem: Browser memory usage increases over time
Common Causes:
-
Event Listeners Not Cleaned Up
useEffect(() => {const handler = () => {};window.addEventListener("event", handler);// Must return cleanup!return () => window.removeEventListener("event", handler);}, []); -
WebSocket Not Unsubscribed
useEffect(() => {const wsExt = getExtension("@invent/bff-ws-ext");wsExt.subscribe("Event", "subscription-id", handler);// Must unsubscribe!return () => wsExt.unsubscribe("Event", "subscription-id");}, []); -
State Not Cleaned Up
- Use
useDeleteSharedValuewhen widget unmounts - Clear intervals and timeouts
- Use
Get Help
- Check GitLab Issues for similar problems
- Review example widgets in the platform
- Contact your INVENT technical manager
- Check platform status page
Report an Issue
If you've found a bug or issue not covered here:
- Check GitLab Issues first
- Gather error details:
- Error messages (full stack trace)
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Node version, OS, etc.)
- Create issue in appropriate repository