question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow using Parcel 2 for NodejsFunction

See original GitHub issue

Right now, the documentation requires running Parcel^1

https://github.com/aws/aws-cdk/blob/f3219c310f8c0edbf929bfc9ef1bb7363b1506ae/packages/%40aws-cdk/aws-lambda-nodejs/README.md#L17-L21

There are bug fixes, such as this one (https://github.com/parcel-bundler/parcel/issues/3151#issuecomment-553325935) that are only made to Parcel v2 and not v1.

Use Case

The aws-xray-sdk-node package relies on async_hooks, and as described in this bug report: https://github.com/parcel-bundler/parcel/issues/3151 , fails to build under Parcel ^1. @gergan actually reported on that issue that he needs a workaround specifically because of the CDK’s NodejsFunction reliance on Parcel v1: https://github.com/parcel-bundler/parcel/issues/3151#issuecomment-618453216

Proposed Solution

Allow using Parcel ^2. I’m not sure why the docs peg to v1 right now - I’m assuming there’s a reason that v2 was incompatible for some reason. If it’s actually compatible with v2, then we could also update the docs referenced above.

Other

I created a sample repo to show the problem with Parcel here (see the README). I also filed https://github.com/DataDog/datadog-lambda-layer-js/issues/73 with the package that’s pulling aws-xray-sdk-node for more context.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
eladbcommented, May 6, 2020

@jogold Could we allow users to fully customize their bundling step once we have docker based bundling?

1reaction
jogoldcommented, May 4, 2020

Hi @blimmer

The reason is that Parcel v2 is still in alpha (https://www.npmjs.com/package/parcel?activeTab=versions, https://github.com/parcel-bundler/parcel/projects/5).

Not totally comfortable to use an alpha version for this construct.

To be updated when Parcel officially releases v2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration - Parcel
Let's walk through a couple basic steps to upgrade from Parcel 1 to Parcel 2. ... You can also do this by using...
Read more >
class NodejsFunction (construct) · AWS CDK
Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Lambda function source ...
Read more >
AWS CDK - aws-lambda-nodejs Module (updated)
Benchmarking #2. My Dynamo Lambda Loader project has just one function in it, but that function has aws-sdk and faker as dependencies. Let's...
Read more >
Self-mutating CI/CD and native Lambda dependencies in CDK
Today I'd like to talk about two of the newer features that have come ... By default NodejsFunction will use Parcel to transpile...
Read more >
@aws-cdk/aws-lambda-nodejs | Yarn - Package Manager
The NodejsFunction construct creates a Lambda function with automatic transpiling and bundling of TypeScript or Javascript code. This results in smaller ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found