Hermanverschooten
I have been using absinthe for a while now, and a couple of months ago we switched from webpack to parcel for our JS bundling. All worked fine for some time, until recently I was notified by one of our clients that the site was no longer working, the wheel kept spinning. I investigated and found a JS error on calling AbsintheSocket.create was logged. The odd thing was that at first, the page still worked in dev, but after an upgrade of some npm stuff, it gave the same error. Initially my guess was something in parcel was causing this and as I had learned that phoenix 1.6 will prefer esbuild. I branched and tried that only to find that the same error still occurs.
Wanting to make sure it is not something else in my code that triggers this error, I cloned the phx_esbuild_demo repo that @josevalim was kind enough to provide. I added the @absinthe/socket npm package, imported it in js/app.js, and it triggers the same error.
I pushed the repo to github (GitHub - Hermanverschooten/phx_esbuild_demo: Test for absinthe socket · GitHub, branch test_absinthe).
Has anyone else run into this error and found a solution? The only reference I find googling has to do with shadow-cljs, but I do not see any solution there.
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Hermanverschooten
In the mean time I found that replacing
with
seems to work with
esbuildbut sadly not withparcel v2.0.0-rc.0.maartenvanvliet
The phx_esbuild_repo you link to is empty.
Hermanverschooten
Oops, code is there now.
mogelbrod
Having the same problem using
parcel@2.0.0-rc.0:The shadow-cljs thread I believe @Hermanverschooten referred to: https://clojurians-log.clojureverse.org/shadow-cljs/2018-08-10
Related github issue: Runtime Error - Cannot instantiate an arrow function · Issue #365 · thheller/shadow-cljs · GitHub
Hermanverschooten
This problem is keeping me from upgrading to Phoenix 1.6. With
requireinstead ofimportit works foresbuildwith phx 1.5, but no longer with 1.6. I tried contacting the original creator of absinthe_socket through slack, but to no avail. And my JS knowledge is not good enough to rewrite.Hermanverschooten
Just for information, the
requireform now works with phoenix as of 1.6.2neurodynamic
I had the
requirefix working for a while withesbuild, but for unrelated reasons I recently started using esbuild’s inject feature and that has brought theUncaught TypeError: Cannot instantiate an arrow functionissue with@absinthe/socketback. When I use theinjectoption, I see the error, and when I take it out, everything’s fine.Assuming it was an issue with using arrow function syntax, I even rewrote the
@absinthe/socketlibrary and published a version without arrow syntax under@absinthe-noarrows/socketbut that doesn’t seem to fix the problem either. I’m completely at a loss. It seems like I either need to find a way to replaceprocess.cwd()without usinginject(which is needed forpath-browserify), or I can’t use@absinthe/socket.Anyone have any idea:
injectwould cause it?@absinthe/socketcode wouldn’t fix it?hubertlepicki
@neurodynamic do you remember fixing the issue by any chance? I am stuck on the same error too
neurodynamic
Looking back through my commits, it looks like I eventually just gave up on using the inject feature. Sorry I don’t have better news!
hubertlepicki
okay thanks.
I have decided to update the dependencies and migrate to graphql-ws which should work as a drop-in replacement: GraphQLWsLink - Apollo GraphQL Docs
Keep your fingers crossed ;D