Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on start #22

Open
j-palindrome opened this issue Apr 4, 2024 · 0 comments
Open

Error on start #22

j-palindrome opened this issue Apr 4, 2024 · 0 comments

Comments

@j-palindrome
Copy link

j-palindrome commented Apr 4, 2024

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
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

No branches or pull requests

1 participant