Serverless target for builds breaks in production
See original GitHub issueBug report
next dev works as expected
Describe the bug
next build fails when building dependency
ReferenceError: Blob is not defined
To Reproduce
yarn add @auth0/auth0-spa-js@1.7.0- Use as expected in development
next buildworks for notargetin next.config.jsnext buildfails for targetserverless
Screenshots
Error:


System information
- Version of Next.js: v9.3.5
- Version of Node.js: v12.11.1
Additional context
Seems like a different version of @auth0/auth0-spa-js@1.7.0 is being imported for next build vs. next dev
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[BUG] serverless deploy fail through the nx plugin #55 - GitHub
First we create a package, I modified my angular.json to have this run target. npx ng run api:package # Next i run the...
Read more >Best practices for organizing larger serverless applications
Well-designed serverless applications are decoupled, stateless, and use minimal code. As projects grow, a goal for development managers is ...
Read more >Why local development for serverless is an anti-pattern
Developing locally when building a serverless application is not only tiresome and hard to do its actually bad for you.
Read more >Serverless Event-Driven Systems | by Lee James Gilmore
This article aims to cover why you should have an event-driven first mindset when building out your Serverless architectures, and why Amazon EventBridge ......
Read more >So you wanna build a Production-ready Serverless App?
So you wanna build a Production-ready Serverless App? I've been exploring serverless security for around a year now. Commonly, as a security pro ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

auth0-spa-js 1.8.0 fixed this error for me
I ran into a similar problem with SSR build on gatsby. Build is failing on
import createAuth0Client from "@auth0/auth0-spa-js";Possibly because “@auth0/auth0-spa-js”@“1.7.0” is referencing browser in Auth0Client constructor:
https://github.com/auth0/auth0-spa-js/blob/2fb88ce280dc87de681c9cb0d721be5d28c651a3/src/Auth0Client.ts#L120
There could be workaround: import from “auth0/auth0-spa-js” dynamically.