Skip to content

fix: set base URL to '/' and add comprehensive tests - #1393

Merged
AvivAbachi merged 17 commits into
mainfrom
claude/issue-329-20260105-1935
Jan 7, 2026
Merged

fix: set base URL to '/' and add comprehensive tests#1393
AvivAbachi merged 17 commits into
mainfrom
claude/issue-329-20260105-1935

Conversation

@AvivAbachi

Copy link
Copy Markdown
Collaborator

This PR fixes the base URL configuration issue where assets were loaded from incorrect paths when navigating to nested routes like /profile/:id.

Changes

  1. Fixed vite.config.ts: Changed base: env?.ASSET_URL || '' to base: env?.ASSET_URL || '/'
  2. Added unit tests: Created vite.config.test.ts to verify base URL configuration logic
  3. Added E2E tests: Created tests/baseUrl.spec.ts to verify assets load correctly from root path

Problem

When ASSET_URL was not defined, the base was set to an empty string, causing Vite to use relative paths. When navigating to /profile/8235701, the browser tried to load assets from /profile/assets/... instead of /assets/....

Solution

By defaulting to '/', assets are always loaded from the root path, while still allowing customization via the ASSET_URL environment variable for CDN deployments.

Fixes #329

Generated with Claude Code

- Fixed vite.config.ts to default base URL to '/' instead of ''
- Added unit tests (vite.config.test.ts) to verify base URL configuration
- Added E2E tests (tests/baseUrl.spec.ts) to verify assets load from root path

This ensures assets are loaded from /assets/ instead of /profile/assets/
when navigating to nested routes like /profile/:id.

Fixes #329

Co-authored-by: Aviv <AvivAbachi@users.noreply.github.com>
@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

@AvivAbachi

Copy link
Copy Markdown
Collaborator Author

@claude
when we use preview https://s3.amazonaws.com/noam-gaash.co.il/20727038862/open-bus/1481/index.html
The URL change add env

@claude

claude Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @AvivAbachi's task in 1m 11s —— View job


Analysis of preview environment issue

  • Read repository guidelines
  • Review PR changes and understand the fix
  • Analyze the preview URL and environment configuration
  • Identify the issue and solution

Issue Identified

I found the problem! The preview deployment needs an update because:

  1. Preview URL structure: The preview is deployed to a nested S3 path:

    https://s3.amazonaws.com/noam-gaash.co.il/{run_id}/open-bus/{run_number}/index.html
    
  2. Build configuration: In .github/workflows/build.yml:27, the build runs without setting ASSET_URL:

    - name: Build
      run: npm run build
  3. The problem: With your fix (which is correct for production), base defaults to '/', so assets are referenced as /assets/.... However, in the S3 preview environment, the assets are actually at:

    /20727038862/open-bus/1481/assets/...
    

    But the HTML is trying to load them from /assets/... (the S3 bucket root), which doesn't exist.

Solution

The build workflow needs to set ASSET_URL when building for preview deployments. The fix would be to update .github/workflows/build.yml:

- name: Build
  env:
    ASSET_URL: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.run_number }}/
  run: npm run build

This way:

  • Production builds (no ASSET_URL set) → assets load from / (correct)
  • Preview builds (with ASSET_URL) → assets load from the full S3 URL (correct)
  • Your fix for issue [bug] fix base url #329 still works perfectly for production

Note: I cannot modify workflow files in .github/workflows/ due to GitHub App permissions. Would you like me to create the fix in a different way, or would you prefer to apply this change manually?


@NoamGaash

Copy link
Copy Markdown
Member

@claude see this output:

jest && playwright test --grep-invert visual

PASS src/pages/components/utils/index.test.ts
PASS src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.test.tsx

Test Suites: 2 passed, 2 total
Tests: 9 passed, 9 total
Snapshots: 0 total
Time: 2.35 s
Ran all test suites.
TypeError: Cannot redefine property: Symbol($$jest-matchers-object)
at /home/runner/work/open-bus-map-search/open-bus-map-search/node_modules/@vitest/expect/dist/index.js:667:9

@claude

claude Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @NoamGaash's task in 1m 38s —— View job


Fixed test error ✓

  • Read repository guidelines and test configuration
  • Analyze the error and identify root cause
  • Fix the Jest/Vitest conflict
  • Commit and push changes

Root Cause

The error Cannot redefine property: Symbol($$jest-matchers-object) occurred because:

  1. Jest is configured for unit tests (runs tests in src/)
  2. Playwright is configured for E2E tests (runs tests in tests/)
  3. The new file tests/vite.config.test.ts imported from vitest instead of Jest
  4. When the test suite ran, both Jest and Vitest tried to set up global matchers, causing a conflict

Solution

Removed tests/vite.config.test.ts because:

  • The E2E tests in tests/baseUrl.spec.ts already verify the base URL behavior end-to-end
  • Unit testing a Vite config file with mocks is fragile and doesn't provide much value
  • The E2E tests are more comprehensive and test the actual runtime behavior

This eliminates the Jest/Vitest conflict while maintaining test coverage through the E2E tests.


Branch: claude/issue-329-20260105-1935

github-actions Bot and others added 2 commits January 5, 2026 20:17
Removed the unit test for vite.config.ts because:
- It was causing a conflict between Jest and Vitest matchers
- The E2E tests in baseUrl.spec.ts already verify the base URL
  behavior comprehensively
- Unit testing a build config with mocks is fragile and provides
  limited value compared to E2E tests

Co-authored-by: Noam Gaash <NoamGaash@users.noreply.github.com>
Comment thread tests/baseUrl.spec.ts Outdated
Comment thread tests/baseUrl.spec.ts Outdated
Comment thread tests/baseUrl.spec.ts Outdated
@AvivAbachi

Copy link
Copy Markdown
Collaborator Author

@claude can you fix all the commect

@claude

claude Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @AvivAbachi's task in 1m 28s —— View job


Fixed review comments ✓

  • Read test file to understand current implementation
  • Add array verification at line 19
  • Add array verification at line 57
  • Add array verification at line 79
  • Commit and push changes

Summary

Added expect(assetScripts.length).toBeGreaterThan(0) and expect(assetLinks.length).toBeGreaterThan(0) assertions to all three test cases in tests/baseUrl.spec.ts. This ensures that:

  1. Line 22: Verifies asset scripts are found before testing their paths on nested routes
  2. Line 63: Verifies asset scripts are found before testing their paths on dashboard
  3. Line 88: Verifies asset CSS links are found before testing their paths on nested routes

These assertions guarantee that the tests are actually checking meaningful data rather than passing vacuously when no assets are found.


Branch: claude/issue-329-20260105-1935 |

Add expect(array.length).toBeGreaterThan(0) checks to ensure tests
are actually verifying meaningful data.

Co-authored-by: Aviv <AvivAbachi@users.noreply.github.com>
@AvivAbachi

AvivAbachi commented Jan 7, 2026

Copy link
Copy Markdown
Collaborator Author

@claude unable to load page on preview server https://s3.amazonaws.com/noam-gaash.co.il/20776238780/open-bus/1489/index.html

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "WebInspector",
      "version": "537.36"
    },
    "pages": [
      {
        "startedDateTime": "2026-01-07T09:04:22.678Z",
        "id": "page_1",
        "title": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html",
        "pageTimings": {
          "onContentLoad": 353.3980000001975,
          "onLoad": 386.4770000000135
        }
      }
    ],
    "entries": [
      {
        "_connectionId": "36644",
        "_initiator": {
          "type": "other"
        },
        "_priority": "VeryHigh",
        "_resourceType": "document",
        "cache": {},
        "connection": "443",
        "pageref": "page_1",
        "request": {
          "method": "GET",
          "url": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Accept",
              "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br, zstd"
            },
            {
              "name": "Accept-Language",
              "value": "en-IL,en-GB;q=0.9,en-US;q=0.8,en;q=0.7"
            },
            {
              "name": "Cache-Control",
              "value": "max-age=0"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Host",
              "value": "s3.amazonaws.com"
            },
            {
              "name": "If-Modified-Since",
              "value": "Mon, 05 Jan 2026 20:21:25 GMT"
            },
            {
              "name": "If-None-Match",
              "value": "\"8c2fc8cc909ac7160fc8cf9633a5fc7b\""
            },
            {
              "name": "Referer",
              "value": "https://github.com/hasadna/open-bus-map-search/pull/1393"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "document"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "navigate"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            },
            {
              "name": "Sec-Fetch-User",
              "value": "?1"
            },
            {
              "name": "Upgrade-Insecure-Requests",
              "value": "1"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
            },
            {
              "name": "sec-ch-ua",
              "value": "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\""
            },
            {
              "name": "sec-ch-ua-mobile",
              "value": "?0"
            },
            {
              "name": "sec-ch-ua-platform",
              "value": "\"Windows\""
            }
          ],
          "queryString": [],
          "cookies": [],
          "headersSize": 941,
          "bodySize": 0
        },
        "response": {
          "status": 304,
          "statusText": "Not Modified",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Date",
              "value": "Wed, 07 Jan 2026 09:04:27 GMT"
            },
            {
              "name": "ETag",
              "value": "\"8c2fc8cc909ac7160fc8cf9633a5fc7b\""
            },
            {
              "name": "Last-Modified",
              "value": "Mon, 05 Jan 2026 20:21:25 GMT"
            },
            {
              "name": "Server",
              "value": "AmazonS3"
            },
            {
              "name": "x-amz-expiration",
              "value": "expiry-date=\"Tue, 13 Jan 2026 00:00:00 GMT\", rule-id=\"delete old things\""
            },
            {
              "name": "x-amz-id-2",
              "value": "zBEvvXbu0z8yh5WSlhlTOiDgkUB7ovOVcL1DHJpgffg30kJ1RH/42FLVPicEDSoZ6umafPDggIZ0KY5cxKgn/gtbXlZIsmu3"
            },
            {
              "name": "x-amz-request-id",
              "value": "QBCZE71N211WC1N1"
            }
          ],
          "cookies": [],
          "content": {
            "size": 3251,
            "mimeType": "text/html"
          },
          "redirectURL": "",
          "headersSize": 410,
          "bodySize": 0,
          "_transferSize": 410,
          "_error": null,
          "_fetchedViaServiceWorker": false
        },
        "serverIPAddress": "16.15.186.81",
        "startedDateTime": "2026-01-07T09:04:22.677Z",
        "time": 160.99300000041694,
        "timings": {
          "blocked": 2.0639999999761347,
          "dns": -1,
          "ssl": -1,
          "connect": -1,
          "send": 0.08399999999999985,
          "wait": 158.2510000003489,
          "receive": 0.5940000000919099,
          "_blocked_queueing": 0.8649999999761349,
          "_workerStart": -1,
          "_workerReady": -1,
          "_workerFetchStart": -1,
          "_workerRespondWithSettled": -1
        }
      },
      {
        "_connectionId": "36644",
        "_initiator": {
          "type": "parser",
          "url": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html",
          "lineNumber": 70
        },
        "_priority": "High",
        "_resourceType": "script",
        "cache": {},
        "connection": "443",
        "pageref": "page_1",
        "request": {
          "method": "GET",
          "url": "https://s3.amazonaws.com/assets/index-DeOHyd6r.js",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br, zstd"
            },
            {
              "name": "Accept-Language",
              "value": "en-IL,en-GB;q=0.9,en-US;q=0.8,en;q=0.7"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Host",
              "value": "s3.amazonaws.com"
            },
            {
              "name": "Origin",
              "value": "https://s3.amazonaws.com"
            },
            {
              "name": "Referer",
              "value": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "script"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "same-origin"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
            },
            {
              "name": "sec-ch-ua",
              "value": "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\""
            },
            {
              "name": "sec-ch-ua-mobile",
              "value": "?0"
            },
            {
              "name": "sec-ch-ua-platform",
              "value": "\"Windows\""
            }
          ],
          "queryString": [],
          "cookies": [],
          "headersSize": 654,
          "bodySize": 0
        },
        "response": {
          "status": 403,
          "statusText": "Forbidden",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/xml"
            },
            {
              "name": "Date",
              "value": "Wed, 07 Jan 2026 09:04:26 GMT"
            },
            {
              "name": "Server",
              "value": "AmazonS3"
            },
            {
              "name": "Transfer-Encoding",
              "value": "chunked"
            },
            {
              "name": "x-amz-id-2",
              "value": "i76JsBH8C68s8h++FMppc8cpYi012Jf1PsSxhbDlT75smzDNLWSvidHzBIkz2v4AOSeL0seYkSjPC2z1ptHxh0DAxO/sXSEP"
            },
            {
              "name": "x-amz-request-id",
              "value": "QBCG52Z9P2JG2K1T"
            }
          ],
          "cookies": [],
          "content": {
            "size": 0,
            "mimeType": "application/xml",
            "compression": 0
          },
          "redirectURL": "",
          "headersSize": 286,
          "bodySize": 0,
          "_transferSize": 286,
          "_error": "net::ERR_ABORTED",
          "_fetchedViaServiceWorker": false
        },
        "serverIPAddress": "16.15.186.81",
        "startedDateTime": "2026-01-07T09:04:22.843Z",
        "time": 172.96400000032008,
        "timings": {
          "blocked": 20.934999999608785,
          "dns": -1,
          "ssl": -1,
          "connect": -1,
          "send": 0.08000000000000007,
          "wait": 151.01500000011356,
          "receive": 0.9340000005977345,
          "_blocked_queueing": 14.293999999608786,
          "_workerStart": -1,
          "_workerReady": -1,
          "_workerFetchStart": -1,
          "_workerRespondWithSettled": -1
        }
      },
      {
        "_connectionId": "36689",
        "_initiator": {
          "type": "parser",
          "url": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html",
          "lineNumber": 71
        },
        "_priority": "VeryHigh",
        "_resourceType": "stylesheet",
        "cache": {},
        "connection": "443",
        "pageref": "page_1",
        "request": {
          "method": "GET",
          "url": "https://s3.amazonaws.com/assets/index-BfYS2xC2.css",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Accept",
              "value": "text/css,*/*;q=0.1"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br, zstd"
            },
            {
              "name": "Accept-Language",
              "value": "en-IL,en-GB;q=0.9,en-US;q=0.8,en;q=0.7"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Host",
              "value": "s3.amazonaws.com"
            },
            {
              "name": "Origin",
              "value": "https://s3.amazonaws.com"
            },
            {
              "name": "Referer",
              "value": "https://s3.amazonaws.com/noam-gaash.co.il/20728029946/open-bus/1485/index.html"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "style"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "same-origin"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
            },
            {
              "name": "sec-ch-ua",
              "value": "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\""
            },
            {
              "name": "sec-ch-ua-mobile",
              "value": "?0"
            },
            {
              "name": "sec-ch-ua-platform",
              "value": "\"Windows\""
            }
          ],
          "queryString": [],
          "cookies": [],
          "headersSize": 669,
          "bodySize": 0
        },
        "response": {
          "status": 403,
          "statusText": "Forbidden",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/xml"
            },
            {
              "name": "Date",
              "value": "Wed, 07 Jan 2026 09:04:26 GMT"
            },
            {
              "name": "Server",
              "value": "AmazonS3"
            },
            {
              "name": "Transfer-Encoding",
              "value": "chunked"
            },
            {
              "name": "x-amz-id-2",
              "value": "qHO0OrKMdJnokkQclaLpFVH2xjztfDfmIWCDX2aon2pxsegRnmqR8metF8LhMFC7JF0NAdSfWcuKm20Of+txfQH39JW488zA"
            },
            {
              "name": "x-amz-request-id",
              "value": "QBCRH00DF4AYGARA"
            }
          ],
          "cookies": [],
          "content": {
            "size": 0,
            "mimeType": "application/xml",
            "compression": 0
          },
          "redirectURL": "",
          "headersSize": 286,
          "bodySize": 0,
          "_transferSize": 286,
          "_error": "net::ERR_ABORTED",
          "_fetchedViaServiceWorker": false
        },
        "serverIPAddress": "16.15.186.81",
        "startedDateTime": "2026-01-07T09:04:22.844Z",
        "time": 187.75099999947997,
        "timings": {
          "blocked": 22.181999999781603,
          "dns": -1,
          "ssl": -1,
          "connect": -1,
          "send": 0.07900000000000063,
          "wait": 164.07100000043883,
          "receive": 1.4189999992595403,
          "_blocked_queueing": 18.052999999781605,
          "_workerStart": -1,
          "_workerReady": -1,
          "_workerFetchStart": -1,
          "_workerRespondWithSettled": -1
        }
      }
    ]
  }
}

@claude

claude Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @AvivAbachi's task in 1m 1s —— View job


Preview deployment issue analyzed ✓

  • Read build workflow configuration
  • Read vite.config.ts to understand ASSET_URL usage
  • Analyze the HAR data and identify root cause
  • Provide solution

Root Cause

The HAR data shows assets are failing with 403 Forbidden errors:

  • ❌ Requested: https://s3.amazonaws.com/assets/index-DeOHyd6r.js
  • ✓ Should be: https://s3.amazonaws.com/noam-gaash.co.il/20776238780/open-bus/1489/assets/index-DeOHyd6r.js

The Problem:

  1. .github/workflows/build.yml:9-10 defines ASSET_URL at the workflow level
  2. However, vite.config.ts:11 reads ASSET_URL from loadEnv() which loads from .env files, NOT from the build process environment
  3. The workflow-level env is not being passed to the Vite build process

Solution

The ASSET_URL needs to be passed as an environment variable to the build step. Update .github/workflows/build.yml:26-27:

- name: Build
  env:
    ASSET_URL: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.run_number }}/
  run: npm run build

This will make ASSET_URL available to the Vite build process via process.env.ASSET_URL, and then vite.config.ts:11 will use it correctly.

Why I Can't Fix This

I'm unable to modify files in .github/workflows/ due to GitHub App permissions restrictions. The repository maintainer will need to apply this change manually.

Alternative Workaround (if workflow can't be modified)

If modifying the workflow is not possible, you could update vite.config.ts to read from process.env.ASSET_URL instead of from loadEnv():

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd())
  
  return {
    base: process.env.ASSET_URL || env?.ASSET_URL || '/',
    // ... rest of config

This would check process.env.ASSET_URL first (set by workflow), then fall back to loadEnv(), then finally to '/'.


Branch: claude/issue-329-20260105-1935 | View job

@hasadna hasadna deleted a comment from claude Bot Jan 7, 2026
@AvivAbachi

Copy link
Copy Markdown
Collaborator Author

@claude this is still not working maybe in to have fix in react-route?
src\routes\index.tsx
createBrowserRouter(routes,{basename:''})

@claude

claude Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @AvivAbachi's task in 1m 14s —— View job


Analysis Complete ✓

  • Read current router configuration in src/routes/index.tsx
  • Read vite.config.ts to understand base URL setup
  • Analyze the relationship between Vite base and React Router basename
  • Determine the correct solution
  • Provide explanation and solution

The Issue

React Router's basename is NOT the problem. The issue is with how Vite's base config is being set.

Two Different Concepts:

  1. Vite's base - Controls where assets (JS/CSS) are loaded from (this is broken ❌)
  2. React Router's basename - Controls URL path prefix for routing (this is fine ✓)

Root Cause:

Looking at vite.config.ts:10:

base: env?.PREVIEW_URL || '/',

And .github/workflows/build.yml:10:

PREVIEW_URL: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.run_number }}/

The problem: Vite's base expects a path like /my-app/ or just /, but PREVIEW_URL is a full URL like https://s3.amazonaws.com/.../.

When Vite sees a full URL in base, it generates asset paths like:

<script src="https://s3.amazonaws.com/.../assets/index-DeOHyd6r.js"></script>

But your HAR log shows it's actually requesting:

https://s3.amazonaws.com/assets/index-DeOHyd6r.js  ❌

This happens because Vite treats the URL as a path, leading to malformed asset URLs.


The Solution

Option 1: Use relative path for preview (Recommended)

Change vite.config.ts:10 to:

base: './',  // Always use relative paths

This makes all asset paths relative (./assets/...), which works everywhere - production, preview, and nested routes.

Option 2: Extract path from PREVIEW_URL

If you need different bases for production vs preview:

base: env?.PREVIEW_URL 
  ? new URL(env.PREVIEW_URL).pathname 
  : '/',

This extracts just the path part (/noam-gaash.co.il/.../) from the full URL.


Why React Router's basename won't help

Setting basename in React Router only affects routing logic (which component to render for which URL). It doesn't affect where the browser loads JS/CSS files from. The 403 errors in your HAR log are asset loading failures, not routing issues.


Branch: claude/issue-329-20260105-1935 |

@AvivAbachi

Copy link
Copy Markdown
Collaborator Author

@claude

is working now but there is problem on preview server is cut the url
current - https://s3.amazonaws.com/storybook/index.html

how is needed to be - https://s3.amazonaws.com/noam-gaash.co.il/20777620048/open-bus/1493/storybook/index.html

@claude

claude Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @AvivAbachi's task in 1m 52s —— View job


Fixed Storybook preview URL ✓

  • Read Storybook configuration files
  • Check build workflow for Storybook build steps
  • Fix Storybook base URL configuration
  • Commit and push Storybook config changes

Changes Made

Updated .storybook/main.ts: Added viteFinal hook to configure base URL from environment variable

viteFinal: async (config) => {
  // Set base URL from environment variable for preview deployments
  config.base = process.env.VITE_PREVIEW_URL
    ? `${process.env.VITE_PREVIEW_URL}storybook/`
    : '/storybook/'
  return config
}

This ensures:

  • Preview deployments: Storybook loads assets from https://s3.amazonaws.com/noam-gaash.co.il/{run_id}/open-bus/{run_number}/storybook/
  • Production: Storybook loads assets from /storybook/

Workflow File Limitation

I was unable to push the required change to .github/workflows/build.yml due to GitHub App permissions (workflows require special workflows permission).

The workflow needs this manual update at line 47:

- name: Build Storybook
  env:
    VITE_PREVIEW_URL: ${{ env.VITE_PREVIEW_URL }}
  run: npm run build-storybook -- -o dist/storybook

This passes the VITE_PREVIEW_URL environment variable to the Storybook build process, similar to how it's done for the main app build at line 27-29.

Without this workflow change, the Storybook config won't have access to the preview URL and will fall back to /storybook/.


Branch: claude/issue-329-20260105-1935 |

@AvivAbachi
AvivAbachi requested a review from NoamGaash January 7, 2026 13:58

@NoamGaash NoamGaash left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!
Just making sure - we don't use the outputs of the build workflow for the docker image version, right?

@AvivAbachi

Copy link
Copy Markdown
Collaborator Author

Cool! Just making sure - we don't use the outputs of the build workflow for the docker image version, right?

Docker build takes form validate.yaml > "Docker Build" if i not wrong

@AvivAbachi

AvivAbachi commented Jan 7, 2026

Copy link
Copy Markdown
Collaborator Author

i cheak whit local docker no problems, lets hop for the bests.

update: work on live

@AvivAbachi
AvivAbachi merged commit 4ddeef6 into main Jan 7, 2026
21 checks passed
@AvivAbachi
AvivAbachi deleted the claude/issue-329-20260105-1935 branch January 7, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] fix base url

2 participants