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: EISDIR: illegal operation on a directory, read #50

Open
MA-Jesse opened this issue Mar 24, 2022 · 5 comments
Open

Error: EISDIR: illegal operation on a directory, read #50

MA-Jesse opened this issue Mar 24, 2022 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@MA-Jesse
Copy link

We're using a mono-repo with yarn workspaces and lerna. We have no-hoist enabled for packages/functions so all node_modules related to packages/functions are contained there.

When running firelink from to packages/functions we get this error....

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[Error: EISDIR: illegal operation on a directory, read] {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'read'
}

Not sure why but running firelink from the root directory of the repo doesn't throw this error.

@R-Iqbal
Copy link

R-Iqbal commented Mar 25, 2022

So from some further investigation, it appears to be caused by one of our fireDependencies

  "fireDependencies": {
    "@claimsgate/core": "../core",
    "@claimsgate/core-types": "../core-types"
  },

Removing @claimsgate/core from our fireDependencies prevents the issue from happening. But looking further into it, there are almost no differences between the @claimsgate/core and @claimsgate/core-types folders.

@R-Iqbal
Copy link

R-Iqbal commented Mar 25, 2022

Removing node_modules from @claimsgate/core appears to fix the issue but this is odd. The only dependencies for @claimsgate/core are "@claimsgate/core-types": "1.2.0".

In our fireConfig we also exclude the node_modules folder. Potentially, there is some permission issue when reading/writing to the node_modules in packages/core from packages/functions

@R-Iqbal
Copy link

R-Iqbal commented Mar 25, 2022

To summarise:

  1. I'm not entirely sure why removing node_modules from @claimsgate/core causes Firelink to start working correctly.
  2. The only real change we have made to @claimsgate/core has been enabling eslint

@claimsgate/core package.json

{
  "name": "@claimsgate/core",
  "version": "1.2.0",
  "description": "",
  "scripts": {
    "compile": "npx tsc",
    "compile:watch": "npx tsc -w"
  },
  "keywords": [],
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "author": "",
  "dependencies": {
    "@claimsgate/core-types": "1.2.0",
    "@typescript-eslint/eslint-plugin": "^5.16.0",
    "@typescript-eslint/parser": "^5.16.0"
  },
  "devDependencies": {
    "eslint": "^8.11.0",
    "typescript": "^4.5.4"
  },
  "private": true
}

@claimsgate/core tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "allowSyntheticDefaultImports": true,
    "suppressImplicitAnyIndexErrors": true,
    "forceConsistentCasingInFileNames": true,
    "sourceMap": true,
    "declaration": true,
    "strict": false,
    "esModuleInterop": true,
    "allowJs": false,
    "baseUrl": "./src",
    "outDir": "dist",
    "target": "es2020",
    "composite": true,
    "types": ["@claimsgate/core-types"],
    "paths": {}
  },
  "references": [{ "path": "../core-types" }],
  "exclude": ["node_modules", "**/*.spec.ts", "./dist"],
  "include": ["src/**/*.ts"],
  "files": ["index.ts"]
}

@claimsgate/functions package.json

{
  "fireDependencies": {
    "@claimsgate/core-types": "../core-types",
    "@claimsgate/core": "../core"
  },
  "fireConfig": {
    "runner": "firebase",
    "outFolderName": ".packages",
    "outFolderLocation": ".",
    "excludes": [
      "node_modules"
    ]
  }
}

@R-Iqbal
Copy link

R-Iqbal commented Mar 25, 2022

Okay I figured it out. Removing @claimsgate/core from no-hoist in our root package.json solved the problem!

I'm guessing there's an error in resolving the directory of node_modules somewhere in the code when dependencies are hoisted for a given fireDependency

@Stradivario
Copy link
Member

Wow thanks for the great information provided i will try to replicate the issue and see what causes it

Is your project started with some Yarn or Lerna starter if it is possible to clone it directly and test the things out ?

Anyway i will try to mimic the problem using your provided information in this ticket for now.

Great job guys!

@Stradivario Stradivario added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested labels Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants