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.

bug: Unexpected character '#' on build

See original GitHub issue

Describe the bug

Bundling via webpack (via netlify-lambda) fails with the following error:

ERROR in ../node_modules/@panva/jose/lib/jws/sign.js 14:2
Module parse failed: Unexpected character '#' (14:2)

(Detailed stack trace at the end of this post.)

It appears that webpack barfs at this kind of syntax with the #

class Sign {
  #b64
  #payload
  #recipients
  ...

I’m submitting an issue here because ‘#’ appears to be invalid syntax.

To Reproduce

Steps to reproduce the behaviour:

  1. git clone https://github.com/rendall/jwt-implementation/tree/%40panva/jose
  2. cd ./jwt* or otherwise into project directory
  3. npm / yarn install
  4. npm / yarn run build

Expected behaviour

That there be no Unexpected character error.

Environment:

Additional context Add any other context about the problem here.

  • the bug is happening on latest @panva/jose too.
  • i have tried DEBUG (see readme.md) and can see the issue is with the provider and not my code.
  • i have searched the issues tracker on github for similar issues and couldn’t find anything related.

Detailed Error stack trace

netlify-lambda: Building functions
Hash: c3ac99528bc9843d63e5
Version: webpack 4.30.0
Time: 2110ms
Built at: 04/27/2019 7:55:37 AM
  Asset     Size  Chunks  Chunk Names
auth.js  124 KiB       0  auth
Entrypoint auth = auth.js
 [0] external "crypto" 42 bytes {0} [built]
 [2] ../node_modules/@panva/jose/lib/errors.js 275 bytes {0} [built] [failed] [1 error]
 [5] ../node_modules/@panva/jose/lib/jwk/key/base.js 5.89 KiB {0} [built]
[10] ../node_modules/@panva/jose/lib/jwks/keystore.js 202 bytes {0} [built] [failed] [1 error]
[16] ../node_modules/@panva/jose/lib/jwk/generate.js 1.5 KiB {0} [built]
[18] ../node_modules/@panva/jose/lib/jws/index.js 525 bytes {0} [built]
[31] ../node_modules/@panva/jose/lib/jwk/index.js 298 bytes {0} [built]
[37] ../node_modules/@panva/jose/lib/index.js 178 bytes {0} [built]
[38] ../node_modules/dotenv/lib/main.js 2.87 KiB {0} [built]
[39] ./auth.js 3.21 KiB {0} [built]
[40] ../node_modules/@panva/jose/lib/jwe/index.js 570 bytes {0} [built]
[85] ../node_modules/@panva/jose/lib/jwks/index.js 70 bytes {0} [built]
[89] ../node_modules/@panva/jose/lib/jwt/index.js 150 bytes {0} [built]
[92] external "fs" 42 bytes {0} [built]
[93] external "path" 42 bytes {0} [built]
    + 79 hidden modules

ERROR in ../node_modules/@panva/jose/lib/jws/sign.js 14:2
Module parse failed: Unexpected character '#' (14:2)
You may need an appropriate loader to handle this file type.
|
| class Sign {
>   #b64
|   #payload
|   #recipients
 @ ../node_modules/@panva/jose/lib/jws/index.js 1:13-30
 @ ../node_modules/@panva/jose/lib/index.js
 @ ./auth.js

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
panvacommented, Apr 27, 2019

Then don’t transpile @panva/jose dependency until your tooling is ready to recognize the new javascript syntax.

1reaction
panvacommented, Aug 22, 2019

I’ve made @panva/jose compatible with lts/dubnium, it is now being tested with Node.js ^10.13.0 || >=12.0.0 and Electron ^6.0.0

It is not without caveats, but they are acceptable.

  • Importing X.509 certificates and handling x5c is only supported when Node.js >= 12.0.0 runtime is detected
  • OKP keys are only supported when Node.js >= 12.0.0 runtime is detected
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error of build because of the error Module parse failed
I have trouble related to Unexpected character of node module file. Here is my next.config.js file /** * @type {import('next').
Read more >
error CS1056: Unexpected character - Visual Studio Feedback
While using TFS 2017, I created a build that runs 1 test and I get this error from a couple of libraries that...
Read more >
Bug - [Burst] Error CS1056: Unexpected Character - Unity Forum
Bug [Burst] Error CS1056: Unexpected Character' ... I just started a new project and I get this every time I create a new...
Read more >
Fontsource Error - Unexpected character '@' - Roots Discourse
build.rules.css.setInclude([app.path()]);. Try to load modules from the source directory or the node_modules ...
Read more >
Error During ionic Build Module parse Unexpected Character
suddenly all of my project are having this error when i build with ionic build --prod please can anybody help.
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