Skip to content

fix: experiment workers not set up in pushkin-cli currently#376

Open
cherriechang wants to merge 10 commits intofix/aws-deploymentfrom
fix/experiment-workers
Open

fix: experiment workers not set up in pushkin-cli currently#376
cherriechang wants to merge 10 commits intofix/aws-deploymentfrom
fix/experiment-workers

Conversation

@cherriechang
Copy link
Copy Markdown
Contributor

This should enable properly running an experiment and storing its data.
Also needed to verify user authentication system #375

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 6e5a71c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
pushkin-cli Major
pushkin-worker Patch
@pushkin-templates/site-basic Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cherriechang cherriechang self-assigned this Nov 24, 2025
@cherriechang cherriechang added enhancement New feature or request pushkin-cli Relates to the CLI labels Nov 24, 2025
cherriechang and others added 7 commits November 26, 2025 17:15
This commit adds comprehensive Auth0 authentication support to the basic site template, enabling OAuth2/OIDC authentication for Pushkin users. The implementation is backward-compatible and only activates when useAuth is enabled in pushkin.yaml.

Key Changes:
- Added Auth0 authentication components (Login, Logout, Profile)
- Added AuthSync component to synchronize Auth0 state with Redux
- Enhanced Redux infrastructure to handle both Auth0 and session-based auth
- Updated Header component with conditional auth buttons and 'My account' link
- Added conditional Auth0Provider wrapper in index.js
- Created config.js to expose authDomain and authClientID from pushkin.yaml
- Added @auth0/auth0-react dependency to package.json
- Added /profile route to App.js

Features:
- Dual authentication modes: Auth0 (when configured) and session-based (fallback)
- Conditional rendering based on useAuth config setting
- Seamless integration with existing Redux state management
- User profile management via Auth0 dashboard
- Automatic token refresh and localStorage caching

Configuration:
Sites can enable Auth0 by setting in pushkin.yaml:
  addons:
    useAuth: true
    authDomain: your-domain.auth0.com
    authClientID: your-client-id

All changes are backward-compatible. Sites without Auth0 configuration will continue using session-based authentication.
- Header's useEffect now skips dispatching getUser() when Auth0 is enabled
- Auth0 users are managed by AuthSync component via SET_AUTH0_USER action
- This prevents session-based user IDs from replacing Auth0 user IDs in Redux

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add heartbeat: 30 configuration to amqp.connect() in pushkin-worker
- Upgrade RabbitMQ from 3.6 to 3.12 in docker-compose template
- Add RABBITMQ_HEARTBEAT environment variable

This fixes the "Heartbeat timeout" error that was preventing experiment
workers from completing database operations. The 30-second heartbeat
interval ensures the connection stays alive during long-running tasks.
…ections

- Fix "Cannot read properties of undefined" error by checking if worker service exists
- Use 'test_db' and 'test_transaction_db' Docker service names instead of localhost
- Use internal port 5432 instead of host-mapped port for TRANS_PORT
- Fixes ECONNREFUSED errors when workers try to connect to databases

This ensures workers can communicate with databases via Docker networking.
@cherriechang cherriechang force-pushed the fix/experiment-workers branch from 06b173a to e2c178d Compare November 26, 2025 22:20
…TaskCreator()

Problem:
When processing multiple workers (e.g., ew_test_worker, ew_test_2_worker):
1. First iteration created a reference to the template object
2. Modified the Docker image property (which mutated the shared template)
3. Second iteration reused the same mutated template object
4. Result: All workers ended up with the last processed worker's Docker image

This caused deployment failures where:
- ew_test_worker service used ew_test_2_worker:latest image (wrong!)
- Workers consumed from incorrect RabbitMQ queues
- Experiments failed to respond to API requests
@jkhartshorne
Copy link
Copy Markdown
Collaborator

@cherriechang -- what should I be looking at for this pull request? (I'm prioritizing getting through these pull requests)

@cherriechang
Copy link
Copy Markdown
Contributor Author

cherriechang commented Jan 14, 2026

@cherriechang -- what should I be looking at for this pull request? (I'm prioritizing getting through these pull requests)

Currently everything is tested in an end-to-end way (this goes for the fix/aws-deployment and feature/authentication-system branches too) -- by making a new test website and seeing if the target feature works 😅 I should add unit tests to this PR before merging it, but if you wanted to you could test the current changes out by making a new test Pushkin site using the version of Pushkin on this branch, adding an experiment with some minimal javascript and seeing if it reaches end of experiment smoothly! Problems to look out for include it getting stuck at a screen that says "Loading...", data not getting saved to the main database, and/or these things failing when user profile/authentication is enabled.

@becky-gilbert
Copy link
Copy Markdown
Contributor

FYI - I'm reviewing this one now to see if it can be merged into #373. There's probably some conflicts/duplication with what I've done on that aws branch, so we can either revert my commits on #373 or I can make changes here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pushkin-cli Relates to the CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants