Native extension no method

Hello!
i have native extension https://github.com/HGPoint/def_native_logger
here is lua code

local engine_info = sys.get_engine_info()
if native_logger then
native_logger.set_engine_log_level(engine_info.is_debug and 0 or 4)
log.set_log_function(native_logger.log)
native_logger.set_listener(engine_log_handler)
end

in release html5 build some users face issue,
app_controller.script:102: attempt to call field ‘set_engine_log_level’ (a nil value)

i checked in most browsers on windows and android, and in android social network apps, can’t repro this issue.

why lua can’t find “set_engine_log_level” method?

Are you able to reproduce this yourself? I don’t see any obvious problems with your extension code.

Nope, can’t reproduce it,but exception comes from more than 500 users, can it be related to this feature https://github.com/defold/defold/pull/6376 ? We migrated from 1.2.192 to 1.3.7

Could be a programmer error? Like setting the native_logger global to something else.

1 Like

Unfortunately no, this is the only using of native_logger, and this error blocks game loading

I see that you have different names for the extension NativeLogger vs native_logger. Could that be an issue somehow? E.g. in ext.manifest.

No, the wasm streaming happens before the engine starts.

I think no, because it works on my pc, and on most users

Also we have very strange logs with last version of app(which on 1.3.7), and engine version 1.2.192

we switched to sentiel ext on 1.3.7, so it’s very unusual

I see no real reason why this behavior should be.
It’s the same Lua as before, so I don’t expect any new bugs there.

And, if the function wasn’t built into the engine, the other users wouldn’t see it either.

My first thing to check would be if the function is overwritten somehow?

Is there a way to replicate the users environment on your side?
Are they using the wasm or the javascript?

Regardingh the screenshot, it suggests that you’re actually running the 1.2.192 engine?
Could it be some problem with how you bundle the app?

No, here is the only place, where i use native_logger

too many different environments, i tried to do this, but no profit

How can i check it?

Yes, but 22 release version was only on 1.3.6, and 1.3.7, so it is very, very strange

1 Like

It seems like your engine (player) version is cached and used by user with new version of the game resources archive.

3 Likes

too many different environments,

Well, just one should suffice, in order to try to replicate the issue.
e.g platform and specific browser+browser version

I’m not sure to be honest.

Yes, but 22 release version was only on 1.3.6, and 1.3.7, so it is very, very strange

If your server is giving the user mixed content, then I guess all things could happen.

Do you have access to a user that can reproduce it for you?
If so, what happens if they do a full refresh of the game? (in effect, trying to refresh all caches)

1 Like

Chrome

Version: 107.0.0

Windows

Version: 10

sys_info.user_agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

In most cases users don’t reply on messages, we asked to change browser, it didn’t help

I bet everything on this!

If @S_R doesn’t use any cache-busting method to serve their assets from CDN, it’s the reason of the issue.

P.S. Great to see that they use Sentinel to track errors :star_struck:

4 Likes

Hi! Thank you all!
Suggestions about cache were right. All html5 client data mixed into the one Frankenstein xD

Now i’m generating [html5] archive_location_prefix and renaming archive folder inside build. (should bob rename it automatically?)

2 Likes

Glad you found it!

You can change the name automatically yourself by generating a settings file that you add to bob: “–settings mybuildinfo.ini”
it will override the settings in the game.project. doc

3 Likes

I’m afraid I’m not quite right about the automatic renaming.
The folder containing * .arcd* and other files is called an archive. Is it possible to rename it by specifying something in the config?
image