remix-server icon indicating copy to clipboard operation
remix-server copied to clipboard

Error on start

Open j-palindrome opened this issue 1 year ago • 0 comments

Upon starting pnpm run dev I get the following error:

TypeError [ERR_INVALID_THIS]: Value of "this" must be of type URLSearchParams
    at new NodeError (node:internal/errors:405:5)
    at Proxy.set (node:internal/url:572:13)
    at Proxy.<anonymous> (.../node_modules/.pnpm/@[email protected]/node_modules/@remix-run/web-fetch/src/headers.js:124:44)
    at createRemixHeaders (/Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/@[email protected]/node_modules/@remix-run/express/dist/server.js:57:17)
    at createRemixRequest (/Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/@[email protected]/node_modules/@remix-run/express/dist/server.js:72:14)
    at /Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/@[email protected]/node_modules/@remix-run/express/dist/server.js:37:21
    at /Users/jreinier/Documents/1_now/sample/apps/server/src/index.ts:87:21
    at Layer.handle [as handle_request] (/Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:144:13)
    at next (/Users/jreinier/Documents/1_now/sample/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:140:7)

Haven't touched the code yet, simply gave it the port for my MongoDB community server (running locally on my Mac) and started it up.

The line in question refers to the apps/server/src/index.ts file:

payload.init({
    express: app,
    mongoURL: MONGODB_URL,
    secret: PAYLOADCMS_SECRET,
    onInit: () => {
        payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
    },
}).then(() => {

    app.use(payload.authenticate);
    
    app.all(
        '*',
        ENVIRONMENT === 'development'
            ? (req, res, next) => {
                  purgeRequireCache();
    
                  return createRequestHandler({
                      build: require(WEB_BUILD_DIR),
                      mode: ENVIRONMENT,
                      getLoadContext(req, res) {
                          return {
                              payload: req.payload,
                              user: req?.user,
                              res,
                          };
                      },
                  })(req, res, next); // <-- here is where it crashes

j-palindrome avatar Apr 04 '24 19:04 j-palindrome