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

"npm run bundleTest" fails #299

Open
lyricnz opened this issue Apr 9, 2024 · 3 comments
Open

"npm run bundleTest" fails #299

lyricnz opened this issue Apr 9, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lyricnz
Copy link
Contributor

lyricnz commented Apr 9, 2024

❯ npm run bundleTest

> revolver@2.0.0 bundleTest
> npm run bundle; npm run bundleTestPrep; npm run bundleTestRun


> revolver@2.0.0 bundle
> npm run clean; webpack; npm run build; zip -9rqj revolver.zip dist


> revolver@2.0.0 clean
> npm run cleanIntermediate; tsc --build ./tsconfig.json --clean && rimraf revolver.zip dist;


> revolver@2.0.0 cleanIntermediate
> rimraf -g 'plugins/**/**.d.ts' 'plugins/**/*.js' 'drivers/**/*.d.ts' 'drivers/**/*.js' 'lib/**/*.d.ts' 'lib/**/*.js' invoke.d.ts invoke.js revolver.d.ts revolver.js

assets by path ../plugins/ 8.56 KiB 19 assets
assets by path ../test/ 165 bytes 15 assets
assets by path ../lib/*.ts 589 KiB
  asset ../lib/config.d.ts 386 KiB [emitted]
  + 10 assets
assets by path ../drivers/*.ts 16.8 KiB
  asset ../drivers/redshiftClusterSnapshot.d.ts 2.27 KiB [emitted]
  + 9 assets
assets by path ../actions/*.ts 1.88 KiB
  asset ../actions/actions.d.ts 1.62 KiB [emitted]
  asset ../actions/audit.d.ts 265 bytes [emitted]
assets by path ../*.ts 163 bytes
  asset ../revolver.d.ts 152 bytes [emitted]
  asset ../invoke.d.ts 11 bytes [emitted]
asset revolver.js 2.66 MiB [emitted] [minimized] (name: main) (id hint: vendors) 1 related asset
orphan modules 6.03 MiB [orphan] 2217 modules
runtime modules 937 bytes 4 modules
built modules 7.28 MiB [built]
  modules by path ./node_modules/ 6.73 MiB 159 modules
  modules by path ./plugins/ 145 KiB
    cacheable modules 143 KiB 19 modules
    + 3 modules
  modules by path ./lib/*.ts 178 KiB
    ./lib/environ.ts 4.04 KiB [built] [code generated]
    + 10 modules
  modules by path ./drivers/ 206 KiB
    optional modules 126 KiB [optional] 6 modules
    + 5 modules
  + 18 modules
webpack 5.91.0 compiled successfully in 25736 ms

> revolver@2.0.0 build
> tsc --build ./tsconfig.json


> revolver@2.0.0 bundleTestPrep
> mkdir dist; cp invoke.js dist; cp test/bundle-test-config.yaml dist/bundle-test-config.yaml; cp resources.json dist/bundle-test-resources.json

mkdir: dist: File exists
cp: resources.json: No such file or directory

> revolver@2.0.0 bundleTestRun
> cd dist; CONFIG_FILE=bundle-test-config.yaml node invoke.js

Running revolver at timestamp [2024-04-09T03:19:39.977Z]
2024-04-09 03:19:39.981	INFO	/revolver.js:2	revolver	Starting revolver, got event {
  id: '0',
  'detail-type': 'Scheduled Event',
  version: '0',
  account: '0',
  time: '2024-04-09T03:19:39.977Z',
  region: 'ap-southeast-2',
  source: 'revolver',
  resources: [],
  detail: 'test-event'
}
2024-04-09 03:19:39.998	DEBUG	/revolver.js:2	revolver	Freezing time: 2024-04-09T03:19:39.977Z -> 2024-04-09T03:19:39.977Z
2024-04-09 03:19:39.998	INFO	/revolver.js:2	revolver	Got time 2024-04-09T03:19:39.977Z
2024-04-09 03:19:39.998	DEBUG	/revolver.js:2	revolver	Fetching config from file /Users/robers19/src/tmp/cloudsnooze-source/dist/bundle-test-config.yaml
...
2024-04-09 03:19:40.060	INFO	/revolver.js:2	revolver:local-aws(123456789012)	Driver rdsInstance is initialising...
2024-04-09 03:19:40.062	INFO	/revolver.js:2	revolver:accountRevolver	Loading resources locally from bundle-test-resources.json
2024-04-09 03:19:40.062	ERROR	/revolver.js:2	revolver:accountRevolver	Error processing account local-aws, stack trace will follow:
2024-04-09 03:19:40.063	ERROR	/revolver.js:2	revolver:accountRevolver
 Error  ENOENT: no such file or directory, open '/Users/robers19/src/tmp/cloudsnooze-source/dist/bundle-test-resources.json', -2, ENOENT, open, /Users/robers19/src/tmp/cloudsnooze-source/dist/bundle-test-resources.json
error stack:
  • promises	async open
	internal/fs/promises:637
  • promises	async Object.readFile
	internal/fs/promises:1246
  • revolver.js	async t.AccountRevolver.loadResources
	/revolver.js:2
  • revolver.js	async t.AccountRevolver.revolve
	/revolver.js:2
  •

  • revolver.js	async m
	/revolver.js:2
  • revolver.js	async t.handler
	/revolver.js:2
2024-04-09 03:19:40.063	INFO	/revolver.js:2	revolver	One revolution done.
Done
@lyricnz
Copy link
Contributor Author

lyricnz commented Apr 9, 2024

gh repo clone github.service.anz/CloudFinOps/cloudsnooze-source
cd cloudsnooze-source
npm install
npm run bundleTest

@lyricnz lyricnz added the bug Something isn't working label Apr 15, 2024
@lyricnz
Copy link
Contributor Author

lyricnz commented Aug 9, 2024

Error message has changed:

> cd dist; CONFIG_FILE=bundle-test-config.yaml node invoke.js

file:///Users/robers19/src/github/innablr/revolver/dist/invoke.js:1
import { handler as revolverHandle } from './revolver.js';
         ^^^^^^^
SyntaxError: The requested module './revolver.js' does not provide an export named 'handler'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:485:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)

Node.js v22.5.1

@lyricnz
Copy link
Contributor Author

lyricnz commented Aug 9, 2024

That looks like because dist/revolver.js is a webpack output (not the original), and import/require works differently??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants