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

Unhandled exception: ERR_INVALID_ARG_TYPE during deployment #470

Open
C-Collamar opened this issue May 25, 2024 · 1 comment
Open

Unhandled exception: ERR_INVALID_ARG_TYPE during deployment #470

C-Collamar opened this issue May 25, 2024 · 1 comment

Comments

@C-Collamar
Copy link

C-Collamar commented May 25, 2024

Describe the bug

When I run npx ng deploy, I get the console error below.

✔ Build Completed
An unhandled exception occurred: The "paths[0]" argument must be of type string. Received undefined
See "C:\Users\CHRIST~1\AppData\Local\Temp\ng-tAjEsr\angular-errors.log" for further details.

Checking angular-errors.log shows:

[error] TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
    at Object.resolve (node:path:171:9)
    at setopts (C:\Users\Christian\Documents\Workspace\hello-world\node_modules\glob\common.js:93:21)
    at new GlobSync (C:\Users\Christian\Documents\Workspace\hello-world\node_modules\glob\sync.js:37:3)
    at Function.globSync [as sync] (C:\Users\Christian\Documents\Workspace\hello-world\node_modules\glob\sync.js:23:10)
    at getFiles (C:\Users\Christian\Documents\Workspace\hello-world\node_modules\@jefiozie\ngx-aws-deploy\src\lib\deploy\index.js:10:17)
    at C:\Users\Christian\Documents\Workspace\hello-world\node_modules\@jefiozie\ngx-aws-deploy\src\lib\deploy\index.js:54:23
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Christian\Documents\Workspace\hello-world\node_modules\tslib\tslib.js:166:62)

To Reproduce

Steps to reproduce the behavior:

  1. Create a new Angular project.

    npx -p @angular/cli ng new hello-world --defaults
  2. Add @jefiozie/ngx-aws-deploy.

    npx ng add @jefiozie/ngx-aws-deploy

    On a side note: running the command above only installs v4.1.0 of this package, instead of the v5.2.0 which is the latest release as of this writing.

  3. Deploy. Environment variables don't need to be set to reproduce the issue.

    npx ng deploy

Expected behavior
I expect npx ng deploy to continue its attempt to deploy, until it fails with the following output as expected, since environment variables aren't set.

❌  Missing authentication settings for AWS
❌  Missing authentication settings for AWS

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Google Chrome
  • Version: 125.0.6422.77 (Official Build) (64-bit) (cohort: Stable)

Additional context

Digging deeper, here are my findings.

image
image

  1. The file in question is in node_modules/@jefiozie/ngx-aws-deploy/src/lib/deploy/index.js.
  2. In no. 2 of the screenshots, the value of architect_1.targetFromTargetString(buildTarget.name) does not contain the outputPath property.
  3. No outputPath property means that getFiles(filesPath) in no. 3 of the screenshot equals getFiles(undefined). I think this causes the error.
  4. No. 4 of the screenshot shows the workaround.

I find no. 2 suspicious, since angular.json has configured projects.hello-world.architect.build.options.outputPath to equal "dist/hello-world". Even when I set projects.hello-world.architect.build.configurations.production.outputPath, no. 2 still does not "see" outputPath.


Workaround
Deploying, while circumventing the error involves a two-step process.

  1. Manually build the application, with npx ng build.
  2. Deploy without rebuidling, with npx ng deploy --no-build.
@rsinghania
Copy link

I m also facing same issue mentioned above.

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

2 participants