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.

Unexpected character '#'

See original GitHub issue

This is a Bug

Description

Using serverless-bundle and TS code, after installing p-map from npm, serverless-webpack fails to bundle my code. It appears a custom loader may be required, or some config to allow private class fields. How can I configure serverless-webpack to support this?

For bug reports:

  • What went wrong?

Webpack fails with:

Serverless: Bundling with Webpack...

ERROR in /foo/bar/node_modules/aggregate-error/index.js 7:1
Module parse failed: Unexpected character '#' (7:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| export default class AggregateError extends Error {
> 	#errors;
| 
| 	name = 'AggregateError';
 @ /foo/bar/node_modules/p-map/index.js 1:0-45 42:17-31
 @ /foo/bar/src/operations/utils.ts
 @ /foo/bar/src/operations/index.ts
 @ /foo/bar/src/api.ts
 @ /foo/bar/src/index.ts
 
 Error ---------------------------------------------------
 
  Error: Webpack compilation error, see stats above
      at /foo/bar/node_modules/serverless-webpack/lib/compile.js:37:15
  • What did you expect should have happened?

Complication success

  • What was the config you used?
  bundle:
    sourceMaps: true
    packager: yarn
    linting: true

package.json:

"dependencies": {
  "p-map": "^5.0.0"
}
  • What stacktrace or error message from your provider did you see?
Module parse failed: Unexpected character '#' (7:1)

Similar or dependent issue(s):

Additional Data

  • Serverless-Webpack Version you’re using: 5.50
  • Webpack version you’re using: 4.46.0
  • Serverless Framework Version you’re using: 2.41.1
  • Operating System: Ubuntu 18.04
  • Stack Trace (if available): See above

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
henhalcommented, Jun 11, 2021

@j0k3r Sorry for the delay. I made a minimal PoC:

import pMap from 'p-map';

export async function hello(event: any) {
  const msg = await pMap(['hello', 'world'], async s => s.toUpperCase());
  return {
    statusCode: 200,
    body: msg
  };
}

With latest stable serverless-bundle (4.3.1), this fails as above. With 5.0.0-beta.2 it packages without issues. So please go ahead and close this one. Thanks for your support.

1reaction
thomaschaafcommented, May 19, 2021

@henhal can you check if it works with the beta? It’s more like a RC right now. We are confident that everything works but changing the webpack version is quite a large change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected Character - TV Tropes
They could be a One-Scene Wonder, someone who had succumbed to Chuck Cunningham Syndrome, simply a Living Prop, a Joke Character, or even...
Read more >
1:1 error Parsing error: Unexpected character ' ' - Stack Overflow
It look like UTF-8 BOM in the begin of your file. If you have notepad++ you can remove it by click to "Encoding"...
Read more >
ParseError: Unexpected character '@' #15832 - GitHub
I'm getting this parsing error (i.e., error Unexpected character '@' ParseError ) returned when running eslint --cache --fix .
Read more >
Unexpected character encountered while parsing value
Unexpected character encountered while parsing value: P. Path '', line 0, position 0. Question. Reactive. API. Application Type. Reactive.
Read more >
Coach error Unexpected character 'u' on line 1, column 7984
6. Next when we run the coach service, then one of the boundary event seems to be failing with error- Unexpected character 'u'...
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