-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: update source-map-support to get correct filepath #521
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just attempted to test this PR E2E and still had an error.
Here's what I've attempted:
- Checkout this branch &
nvm use
- Remove my
node_modules
folder and runnpm cache clean --force
to ensure I'd have the correct dependencies - Run
npm ci
to install the exact deps inpackage-lock.json
- Run
npm run build
to get a built version indist
- Run the built CLI with
node ./dist/cli.js init test-dir
to create a project cd
intotest-dir
and try to run pushnode ../dist/cli.js push . --auth "TOKEN_HERE" --url http://127.0.0.1:5602/ywn --project test-proj --delete
That process resulted in:
➜ node ../dist/cli.js push . --auth "TOKEN_HERE" --url http://127.0.0.1:5602/ywn --project test-12 --delete
> preparing all monitors
✘ [ERROR] [plugin esbuild-multiasset-plugin] ENOENT: no such file or directory, open '/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/file:/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/example.journey.ts'
This error came from the "onLoad" callback registered here:
../src/push/plugin.ts:106:12:
106 │ build.onLoad({ filter: /.*?/, namespace: 'asset' }, async args => {
╵ ~~~~~~
at setup (/Users/lucasfcosta/Repositories/synthetics/src/push/plugin.ts:106:13)
at handlePlugins (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:839:23)
at Object.buildOrServe (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1133:7)
at /Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:2074:17
at new Promise (<anonymous>)
at Object.build (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:2073:14)
at Object.build (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1923:51)
at Bundler.prepare (/Users/lucasfcosta/Repositories/synthetics/src/push/bundler.ts:56:36)
at Bundler.build (/Users/lucasfcosta/Repositories/synthetics/src/push/bundler.ts:84:16)
Error: Build failed with 1 error:
error: ENOENT: no such file or directory, open '/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/file:/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/example.journey.ts'
at failureErrorWithLog (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1599:15)
at /Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1245:28
at runOnEndCallbacks (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1030:63)
at buildResponseToResult (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1243:7)
at /Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:1352:14
at /Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:662:9
at handleIncomingPacket (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:759:9)
at Socket.readFromStdout (/Users/lucasfcosta/Repositories/synthetics/node_modules/esbuild/lib/main.js:629:7)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12) {
errors: [
{
detail: [Error],
location: null,
notes: [Array],
pluginName: 'esbuild-multiasset-plugin',
text: "ENOENT: no such file or directory, open '/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/file:/Users/lucasfcosta/Repositories/synthetics/test-dir/journeys/example.journey.ts'"
}
],
warnings: []
}
> creating all monitors
✓ Pushed
@vigneshshanmugam btw if you're going to be off for a couple of days I'd be happy to pick up this one, just lmk. Otherwise, I'll come back to this one by Monday.
Okay, so after an hour of debugging I've realised this was all my fault during the testing. Here's a funny story: So, the way we get file's locations is through overriding Lines 297 to 323 in 717303f
Within that function, we wrap the file's frame into a call to the third-party module for handling source-maps. Thanks to that call, when we run Lines 306 to 308 in 717303f
Then, we use Lines 317 to 321 in 717303f
Now, the way the filename gets passed to Lines 44 to 58 in 717303f
The problem here is that the Therefore, it uses the old version of the To properly test this fix, I needed the new {
// ...
"dependencies": {
"@elastic/synthetics": "/Users/lucasfcosta/Repositories/synthetics/dist/index.js"
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewvc I think you're gonna find this one funny 😄
How to test
npm run build
npm i -g .
npx elastic-synthetics init test-dir
cd test-dir && npm run push