question-mark
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.

Deploy Netlify Runtime.UserCodeSyntaxError

See original GitHub issue

Describe the bug

One of these two packages is breaking the code to deploy. (@sveltejs/adapter-netlify @sveltejs/kit) I tried removing the yarn.lock and manually updating my packages without touching those two (@sveltejs/adapter-netlify @sveltejs/kit), when testing it locally it works fine even without updating the packages manually. But when deploying it throws Runtime.UserCodeSyntaxError here the link: https://61e9b8ec568f6c00089b81f5--stoic-perlman-4561ab.netlify.app/. I replaced the yarn.lock with another one from a 9 days old project which worked fine, my conclusion is that something is breaking the code with these two packages (@sveltejs/adapter-netlify @sveltejs/kit). Comparison of both yarn.lock here link: https://github.com/gwet-stripe/test-sveltekit/commits/main/yarn.lock

Reproduction

The error is related to deploy with netlify

Logs

functional:
https://github.com/gwet-stripe/test-sveltekit/commit/911fd8ff0d333deb533f5357eaae13c8ea750afd#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de

not functional: 
https://github.com/gwet-stripe/test-sveltekit/commit/96e999682dafe87040be09a1aea85f01bb4842e6#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de

System Info

System:
    OS: Linux 5.10 Kali GNU/Linux Rolling 2021.4
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 11.48 GB / 14.97 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 17.4.0 - ~/.nvm/versions/node/v17.4.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v17.4.0/bin/npm
  Browsers:
    Chrome: 97.0.4692.71
    Firefox: 78.7.0esr
  npmPackages:
    svelte: ^3.46.2 => 3.46.2

Severity

blocking all usage of svelte

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
angezanetticommented, Jan 22, 2022

Ok, I managed to fix the bug! Add this in your netlify.toml:

[functions]
  node_bundler = "esbuild
0reactions
benmccanncommented, Nov 2, 2022

I believe this is no longer occurring. If that’s wrong and you provide an updated project using the latest sveltekit and adapter-netlify then I can take a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function gives 502 error when deployed to Netlify but ...
Currently I get a 502 error when the function is deployed to Netlify, lo… ... “trace”:[“Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '.
Read more >
Deploy Netlify Runtime.UserCodeSyntaxError #3658 - GitHub
Describe the bug One of these two packages is breaking the code to deploy. (@sveltejs/adapter-netlify @sveltejs/kit) I tried removing the ...
Read more >
Netlify error when deployin sveltekit app - Stack Overflow
Go to your Netlify account and select the site you want to build. Switch to “Site settings” > “Build & deploy” > “Environment...
Read more >
Deploy - Cannot use import statement outside a module
UserCodeSyntaxError : SyntaxError: Cannot use import statement outside a module" 1: " at _loadUserApp (/var/runtime/UserFunction.js:98:13)" ...
Read more >
Netlify redirects using serverless functions - Damian Terlecki
If you need a redirection based on a fragment of the parameter or path, you will have to implement it in your SPA...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found