vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.44k stars 965 forks source link

Refreshing admin-ui pages fails with 500 status. #2470

Open agoransson opened 9 months ago

agoransson commented 9 months ago

Describe the bug When refreshing the current page (except root www.my-vendure-server.com/admin) the page reports a 500 error.

{"statusCode":500,"message":"","timestamp":"2023-10-19T19:57:20.947Z","path":"/admin/orders/11"}

Server log shows:

2023-10-19T19:57:20.947233977Z stdout F error 10/19/23, 7:57 PM - [Vendure Server] path must be absolute or specify root to res.sendFile
2023-10-19T19:51:19.95394966Z stdout F     at SendStream.error (/usr/src/app/node_modules/send/index.js:270:17) 
2023-10-19T19:51:19.953946943Z stdout F     at SendStream.emit (node:events:513:28)
2023-10-19T19:51:19.95394321Z stdout F     at SendStream.error (/usr/src/app/node_modules/serve-static/index.js:121:7)
2023-10-19T19:51:19.953921199Z stdout F     at next (/usr/src/app/node_modules/express/lib/router/index.js:280:10)
2023-10-19T19:51:19.953918115Z stdout F     at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:346:12)
2023-10-19T19:51:19.953915295Z stdout F     at /usr/src/app/node_modules/express/lib/router/index.js:286:9
2023-10-19T19:51:19.953912237Z stdout F     at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:328:13)
2023-10-19T19:51:19.95390934Z stdout F     at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
2023-10-19T19:51:19.953905515Z stdout F     at /usr/src/app/node_modules/@vendure/admin-ui-plugin/lib/src/plugin.js:165:17
2023-10-19T19:51:19.953893152Z stdout F     at ServerResponse.sendFile (/usr/src/app/node_modules/express/lib/response.js:441:11)
2023-10-19T19:51:19.953883465Z stdout F TypeError: path must be absolute or specify root to res.sendFile
2023-10-19T19:51:19.953845978Z stdout F error 10/19/23, 7:51 PM - [Vendure Server] path must be absolute or specify root to res.sendFile

To Reproduce Steps to reproduce the behavior:

  1. Navigate into orders
  2. Open an order
  3. Refresh page
  4. See error as above
  5. Open root www.my-vendure-server.com/admin
  6. See the page loading properly

Expected behavior Expected the page to load properly.

Environment (please complete the following information):

Additional context The server is running on Northflank, followed the Northflank deployment guide. Stripe-payment plugin installed.

Using a custom swedish translation, copied english json and editing to swedish language instead. Custom admin build:

// compile-admin-ui.ts
import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
import * as path from 'path';

compileUiExtensions({
    outputPath: path.join(__dirname, '../admin-ui'),
    extensions: [
        {
            translations: {
                sv: path.join(__dirname, 'translations/sv.json')
            }
        }
    ]
}).compile?.().then(() => {
    process.exit(0);
});

AdminUiPlugin config:

        AdminUiPlugin.init({
            route: 'admin',
            port: 3002,
            app: {
                path: 'admin-ui/dist'
            },
            adminUiConfig: {
                defaultLanguage: LanguageCode.sv,
                availableLanguages: [LanguageCode.en, LanguageCode.sv]
            }
        }),
Kyvix commented 3 months ago

Hi,

Im having the same issue did you manage to solve it ?

agoransson commented 3 months ago

@Kyvix Not yet. I've just accepted it for now.

davidhoeck commented 1 month ago

@Kyvix could you please try it with Node v18 or Node v20. Node v16 is not supported in v2.x anymore. See: https://docs.vendure.io/guides/getting-started/installation/#requirements