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

fix(lambda-nodejs): build fails on Windows #8140

Merged
merged 2 commits into from
May 26, 2020

Conversation

jogold
Copy link
Contributor

@jogold jogold commented May 21, 2020

This is because the operations of path are
OS specific. But for the container working directory and inside the container we
never want to use Windows style paths.

Fixes #8107


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

This is because the operations of [`path`](https://nodejs.org/api/path.html) are
OS specific. But for the container working directory and inside the container we
never want to use Windows style paths.

Fixes aws#8107
@jogold jogold changed the title fix(lambda-nodejs): parcel in Docker fails on Windows fix(lambda-nodejs): build fails on Windows May 21, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: b6b0294
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@@ -111,11 +111,11 @@ export class Builder {
'-v', `${this.options.projectRoot}:${containerProjectRoot}`,
'-v', `${path.resolve(this.options.outDir)}:${containerOutDir}`,
...(this.options.cacheDir ? ['-v', `${path.resolve(this.options.cacheDir)}:${containerCacheDir}`] : []),
'-w', path.dirname(containerEntryPath),
'-w', path.dirname(containerEntryPath).replace(/\\/g, '/'), // Always use POSIX paths in the container
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like something we should take to the bundling PR, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #7898 we explicitly ask for a workingDirectory (optional prop) so the user knows that it's a POSIX style path?

Here we had to calculate it using path logic because we are mounting projectRoot but want to work closer to the entry file.

@mergify
Copy link
Contributor

mergify bot commented May 26, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 57e95ab
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented May 26, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 04490b1 into aws:master May 26, 2020
@jogold jogold deleted the lambda-nodejs-windows-path branch May 31, 2020 07:53
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

Successfully merging this pull request may close these issues.

NodejsFunction broken on Windows
3 participants