Skip to content

Error on start #22

@j-palindrome

Description

@j-palindrome

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions