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

goappGetenv is not a function, got undefined #959

Closed
elfprince13 opened this issue May 30, 2024 · 7 comments
Closed

goappGetenv is not a function, got undefined #959

elfprince13 opened this issue May 30, 2024 · 7 comments

Comments

@elfprince13
Copy link

main.main() panics in app.RunWhenOnBrowser when running even a trivial example.

panic: syscall/js: Value.Call: property goappGetenv is not a function, got undefined [recovered]
wasm_exec.js:22 	panic: syscall/js: Value.Call: property goappGetenv is not a function, got undefined
@elfprince13
Copy link
Author

If I upgrade from v9 to v10 I instead get:

panic: JavaScript error: Failed to execute 'replaceChild' on 'Node': parameter 2 is not of type 'Node'. [recovered]
wasm_exec.js:22 	panic: JavaScript error: Failed to execute 'replaceChild' on 'Node': parameter 2 is not of type 'Node'.

@oderwat
Copy link
Contributor

oderwat commented May 30, 2024

Well. I guess you need to show us the code for that trivial example.

I currently have no V10 based public project (but we use V10 since months for our products). Maybe try something we published with V9 in the meantime:

I think the only needed change for V10 is using app.NewZeroComponentFactory(&component{})) with the app.RouteX() but there may be other little things to adjust.

@elfprince13
Copy link
Author

Well. I guess you need to show us the code for that trivial example.

I currently have no V10 based public project (but we use V10 since months for our products). Maybe try something we published with V9 in the meantime:

* https://github.com/oderwat/go-guess-the-number-app

* https://github.com/metatexx/go-app-todo

* https://github.com/oderwat/go-nats-app

I think the only needed change for V10 is using app.NewZeroComponentFactory(&component{})) with the app.RouteX() but there may be other little things to adjust.

I literally just copy-pasted the examples from the site and renamed the module for a project I'm testing.

I checked out and built your go-guess-the-number-app with no errors, but running app and navigating to localhost:8000 shows a page with a broken image that says:

TypeError: import object field 'gojs' is not an Object

@oderwat
Copy link
Contributor

oderwat commented May 30, 2024

Let me check https://github.com/oderwat/go-guess-the-number-app .. this is very old and I forgot that I had this there.

@elfprince13
Copy link
Author

In case it makes a difference, I'm compiling with go version go1.22.3 darwin/arm64, but not getting any compilation errors, only runtime errors.

@oderwat
Copy link
Contributor

oderwat commented May 30, 2024

That is the reason for this one error. The gojs changend between the time my code was written and now. This can't easily be captured by the package.

I quickly rewrote my https://github.com/oderwat/go-guess-the-number-app for V10. Use make run and open http://127.0.0.1:8000

Please tell me if it works for you. I may also update the other examples asap.

@elfprince13
Copy link
Author

elfprince13 commented May 30, 2024

For posterity - it seems the cluster of related issues here is that there are a bunch of files needed to serve the site statically which can only be generated with app.GenerateStaticWebsite. I'll open a fresh issue when I have a better sense of the workflow that I actually want for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants