Skip to content

Version 9 doesn't work through Skypack #4830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wperron opened this issue Apr 23, 2021 · 3 comments · Fixed by #4836
Closed

Version 9 doesn't work through Skypack #4830

wperron opened this issue Apr 23, 2021 · 3 comments · Fixed by #4836

Comments

@wperron
Copy link

wperron commented Apr 23, 2021

[REQUIRED] Describe your environment

  • Operating System version: Ubuntu 20.10
  • Browser version: Deno 1.9.2
  • Firebase SDK version: 9.0.0-beta.1
  • Firebase Product: app, firestore

[REQUIRED] Describe the problem

I'm trying to run a simple script in Deno to add data to Firestore, I tried the stable version of the SDK but it doesn't work because it relies on XMLHttpRequest doesn't support (our problem, not Firebase's). I then tried version 9 in beta but Skypack is erroring out with this error message:

Download https://cdn.skypack.dev/[email protected]/app?dist=es2017&dts
Download https://cdn.skypack.dev/[email protected]/firestore?dist=es2017&dts
Download https://cdn.skypack.dev/new/[email protected]/dist=es2017/app
Download https://cdn.skypack.dev/new/[email protected]/dist=es2017/firestore
Download https://cdn.skypack.dev/error/build:[email protected]
Download https://cdn.skypack.dev/error/build:[email protected]
[Package Error] "[email protected]" could not be built. 
[1/5] Verifying package is valid…
[2/5] Installing dependencies from npm…
[3/5] Building package using esinstall…
Running esinstall...
@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
ENOENT: no such file or directory, open 'firebase/compat/installations/dist/index.esm.js'
ENOENT: no such file or directory, open '/tmp/cdn/_8cD1Qp4U3uEeSjoy6Fo6/node_modules/firebase/compat/installations/dist/index.esm.js'
error: Uncaught Error: [Package Error] "[email protected]" could not be built. 
    at https://cdn.skypack.dev/error/build:[email protected]:19:7

Steps to reproduce:

Here's the full repro in Deno:

// deno run --no-check this.ts
import firebase from "https://cdn.skypack.dev/[email protected]/app?dist=es2017&dts";
import "https://cdn.skypack.dev/[email protected]/firestore?dist=es2017&dts";

firebase.initializeApp({
  apiKey: "***********************************",
  authDomain: "*******.firebaseapp.com",
  projectId: "**********",
  storageBucket: "***********.appspot.com",
  messagingSenderId: "**********************",
  appId: "1:************:web:***************************"
});

const db = firebase.firestore();
try {
  const docRef = await db.collection("test").add({
    ts: new Date().toISOString(),
  });
  console.log(`successfully added record ${docRef.id}`);
} catch(err) {
  console.error(err)
}
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@Feiyang1
Copy link
Member

I think I know what is causing the error. We need to remove this block in package.json.

Put this compiling error aside, you'll have to rewrite your code in order to use v9. v9 is a total revamp of the SDK, and has a very different API. You need to import individual functions instead of a single firebase object. You can check out our upgrade guide and the reference docs.

@wperron
Copy link
Author

wperron commented Apr 27, 2021

Yeah I've trying a bunch of different things to get it to work inside Deno, flip-flopping between v8 and v9

@firebase firebase locked and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants