nuxt-session icon indicating copy to clipboard operation
nuxt-session copied to clipboard

Unexpected character '�' after upgrade

Open blumgart opened this issue 2 years ago • 3 comments

Environment



Reproduction

No response

Describe the bug

After upgrade from 0.2.3 to 0.2.5 and trying yarn build i get this error:

MZ�♥♦���☺▼�� �!�☺L�!This program cannot be run in DOS mode.
     ^
�n'�R�n'�Richo'�PEd��sjc�" �U��e'�=R��a'�=R�f'�=R��F'�U�l'�o'��'�R��g'�R�n'�R
☻↔�☺↑☺↑�►�☺►☻♠♠@♥♦☻`☺►►►►►p�☻�☻¶�☻( ♥�☺�☻$♥0�☻pЅ☻8☺☻�☻\�☻@.text0�☺►�☺♦ `.rdata��☻��☺@@.datap▼�☻�☻@�.pdata$☻∟�☻@@_RDATA�►♥☻�☻@@.rsrc�☺ ♥☻�☻@@.reloc00�☻3�H��(H�%��☺3�H��(�������������H�♣�}☻H�☺H�H�H�������������H�H�♣♣z☻H��HE���������������@SH��0H�♣��☻H��H��t☻��H�♥H���P►E3�H�D$ E3�3�3��������������������������@SH�� H�♣+}☻H��H�☺��☺t
-y☻耙����������������H�☺�������������@SH�� H�Q@H��H��►r-H�I(H��H��►r↑L�A�H��'I+�H�A�H��▼wMI��蠈H�C8H�♣↓|☻H�C@�C(H�♥H�S↑H��t↑�{ u


 ERROR  Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)

  at error (/E:/Projects/ns-project/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
  at Module.error (/E:/Projects/ns-project/node_modules/rollup/dist/es/shared/rollup.js:12429:16)
  at Module.tryParse (/E:/Projects/ns-project/node_modules/rollup/dist/es/shared/rollup.js:12806:25)
  at Module.setSource (/E:/Projects/ns-project/node_modules/rollup/dist/es/shared/rollup.js:12711:24)
  at ModuleLoader.addModuleSource (/E:/Projects/ns-project/node_modules/rollup/dist/es/shared/rollup.js:21959:20)

Similar problem - nuxt/nuxt.js#15057

npm ls argon2

PS E:\Projects\ns-project> npm ls argon2
ns-project@ E:\Projects\ns-project
└─┬ @sidebase/[email protected]
  └── [email protected]

Additional context

No response

Logs

No response

blumgart avatar Nov 22 '22 13:11 blumgart

Hey @blumgart, thanks for the issue!

pinging @Voltra who implemented this, care to have a look? -> interesting that somebody switched to bcrypt because of it here: https://github.com/nuxt/nuxt.js/issues/15057 (very good link, thanks @blumgart)

BracketJohn avatar Nov 22 '22 14:11 BracketJohn

Encountering the same issue. Resolved once the package was removed.

chexburger avatar Dec 07 '22 03:12 chexburger

@BracketJohn Just confirmed Argon2 to be the issue preventing building.

import * as bcrypt from 'bcrypt';
. . .
export const hashIpAddress = (ip) => !ip ? Promise.resolve(void 0) : bcrypt.hashSync(ip);
export const ipAddressesMatch = (ip, ipHash) => !ip && !ipHash ? Promise.resolve(false) : bcrypt.compareSync(ip, ipHash);

That snippet does not use any salt rounds and defaults to 10. Replacing those respective lines from Argon2 to bcrypt fixes the problem with no build issues. I have not tested this properly yet as I do not use this feature so I have not opened a pull request on this. https://github.com/sidebase/nuxt-session/blob/main/src/runtime/server/middleware/session/ipPinning.ts

chexburger avatar Dec 08 '22 02:12 chexburger