HeyPuter / puter

🌐 The Internet OS! Free, Open-Source, and Self-Hostable.
https://puter.com
GNU Affero General Public License v3.0
26.02k stars 1.72k forks source link

Error when using KV: {success: false, error: 'HOUR is not defined'} #750

Closed KernelDeimos closed 1 month ago

KernelDeimos commented 2 months ago

on Discord

bitsnaps commented 2 months ago

@KernelDeimos The issue appears to be related to the puter.kv.get() function. Unlike the list() function, which does not raise this exception, when you try to get(someKey) for a key that does not exist in the KV store, it throws an error {success: false, error: 'HOUR is not defined'}. According to the documentation, this should return null instead.

The todo example encounters this error immediately upon execution. A minimal reproducible example would be simply calling get() with a non-existent key:

puter.kv.get('todos').then((todos) => {
    console.log(todos);
});

P.S.: Attempting to load puter.js at the <head> or at the bottom of the <body> did not resolve the issue.

KernelDeimos commented 1 month ago

This is fixed and deployed now, thanks for reporting!