Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Javascript seems to only run on the client side.

See original GitHub issue

I’m trying to run some custom javascript from within my symbol component. It works fine when I run on the client but as soon as I set the conditional the state.product is not populated.

I have an input field of type map on my symbol.

The code looks like this, is there something I’m missing?

async function main() {
    if (Builder.isServer || Builder.isEditing) {
        await fetch('/api/product?sku=LEATHER_PURSE')
            .then(res => res.json())
            .then(data => {
                state.product = data;

export default main();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

homanpcommented, Jun 5, 2020

@mrkoreye seems to work fine now yes!

mrkoreyecommented, Jun 2, 2020

Did the fix we made a few weeks ago work for you? Just following up to make sure we resolved this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use browser to run custom JavaScript on page (client side) to ...
Another option is currently AFAIK, Chrome only. You can collect whatever information you need and build a large file from it, then use...
Read more >
Client Side JavaScript does not run at all
Solved: Hello everyone, I'm looking for some help with client side scripting using javascript. I've been stuck on this for a couple of...
Read more >
Running Custom Javascript SSR doesn't seem to work
I'm trying to run some custom JS from within my symbol in SSR mode but can't seem to get it to work. I...
Read more >
Q: How to execute code client-side only · Issue #2473 - GitHub
I have a callback route in my application that receives access token from auth process in URL hash fragment. I'd like to parse...
Read more >
Handling common JavaScript problems - MDN Web Docs
js ' when we called it in the code above). When it has loaded, we run the function we specified as the second...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found