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

yarn build fails with ERR generating artifacts Error: Cannot find module './generated/getAtlassianAuthsByUserId' #10496

Closed
svenseeberg opened this issue Nov 18, 2024 · 1 comment · Fixed by #10508
Labels

Comments

@svenseeberg
Copy link
Contributor

svenseeberg commented Nov 18, 2024

Bug

  • How serious is the bug? P0 - P4
  • OS: GNU/Linux Debian 12
  • Browser: N/A
  • Node version: v20.18.0 & v20.11.0
  • NPM version: 10.8.2 & 10.2.4
  • Yarn version: 1.22.22 & 1.22.5

On a newly cloned repo yarn build with v8.5.1 and down to the 7.x releases fails with:

$ node --max-old-space-size=8192 scripts/prod.js --non-interactive
🙏🙏🙏      Building Production Server      🙏🙏🙏
ERR generating artifacts Error: Cannot find module './generated/getAtlassianAuthsByUserId'
    at webpackMissingModule (webpack://parabol-action/./packages/server/postgres/queries/getAtlassianAuthsByUserId.ts?:2:103)
    at eval (webpack://parabol-action/./packages/server/postgres/queries/getAtlassianAuthsByUserId.ts?:2:215)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:241:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at eval (webpack://parabol-action/./packages/server/graphql/mutations/addAtlassianAuth.ts?:3:34)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:227:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at eval (webpack://parabol-action/./packages/server/graphql/rootMutation.ts?:2:25)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:220:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at eval (webpack://parabol-action/./packages/server/graphql/public/rootSchema.ts?:17:21)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:178:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at eval (webpack://parabol-action/./packages/server/graphql/private/rootSchema.ts?:3:19)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:143:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at eval (webpack://parabol-action/./packages/server/utils/updateGQLSchema.ts?:12:19)
    at Array.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:129:1)
    at __webpack_require__ (/opt/parabol/scripts/toolbox/updateSchema.js:14195:41)
    at /opt/parabol/scripts/toolbox/updateSchema.js:14350:37
    at Object.<anonymous> (/opt/parabol/scripts/toolbox/updateSchema.js:14355:12)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._compile (/opt/parabol/node_modules/pirates/lib/index.js:117:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Object.newLoader [as .js] (/opt/parabol/node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at updateGraphQLSchema (/opt/parabol/scripts/runSchemaUpdater.ts:27:10)
    at runSchemaUpdater (/opt/parabol/scripts/runSchemaUpdater.ts:32:10)
    at async generateGraphQLArtifacts (/opt/parabol/scripts/generateGraphQLArtifacts.js:10:3)
    at async prod (/opt/parabol/scripts/prod.js:24:5) {
  code: 'MODULE_NOT_FOUND'
}
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The file ./packages/server/postgres/queries/getAtlassianAuthsByUserId.ts contains

import getPg from '../getPg'
import {getAtlassianAuthsByUserIdQuery} from generated/getAtlassianAuthsByUserId'
import {AtlassianAuth} from './getAtlassianAuthByUserIdTeamId'

const getAtlassianAuthsByUserId = async (userId: string) => {
  const res = await getAtlassianAuthsByUserIdQuery.run({userId}, getPg())
  if (!res || res.length === 0) return []
  return res.map((atlassianAuth) => ({
    ...atlassianAuth,
    jiraSearchQueries: atlassianAuth.jiraSearchQueries.map((jsq: any) => ({
      ...jsq,
      lastUsedAt: new Date(jsq.lastUsedAt)
    }))
  })) as AtlassianAuth[]
}

export default getAtlassianAuthsByUserId

AFAICT directory ./generated/ does not exist. There are some other dirs in other locations with this name. But the relative path would not point there.

@svenseeberg
Copy link
Contributor Author

It seems that this is a documentation issue. The README states that yarn && yarn build && yarn predeploy && yarn start should be executed for deployment. This is not correct. The steps seem to be yarn && yarn pg:build && yarn build && yarn predeploy && yarn start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant