My app is working just fine but when I use the Firebase emulators, I have a problem with the Storage rules not being obeyed.
I have downloaded the storage.rules file and it is in the same directory as the firebase-json file. The Emulator suite launches just fine and I can see that the Storage emulator is working.
However, when I try to upload an image (as I do in the live app) I get an error.
Error while uploading file: Error Domain=FIRStorageErrorDomain Code=-13021 "User does not have permission to access gs://my-stuff-7796d.appspot.com/Profiles/0ye7psTQA4xR6DfjZRXjjtCWKyPw.jpg." UserInfo={object=Profiles/0ye7psTQA4xR6DfjZRXjjtCWKyPw.jpg, ResponseBody={"error":{"code":403,"message":"Permission denied. No WRITE permission."}}, bucket=my-stuff-7796d.appspot.com, data={length = 74, bytes = 0x7b226572 726f7222 3a7b2263 6f646522 ... 73696f6e 2e227d7d }, data_content_type=application/json; charset=utf-8, NSLocalizedDescription=User does not have permission to access gs://my-stuff-7796d.appspot.com/Profiles/0ye7psTQA4xR6DfjZRXjjtCWKyPw.jpg., ResponseErrorDomain=com.google.HTTPStatus, ResponseErrorCode=403}
The storage.rules are:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
Again, running against the live Firebase works just fine and the rules are obeyed.
Here is my firebase.json file
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"storage": {
"rules": "storage.rules"
},
"emulators": {
"auth": {
"port": 9099
},
"firestore": {
"port": 8080
},
"storage": {
"port": 9199
},
"ui": {
"enabled": true
}
}
}
When I launch my app, this is the code I initialize after call FirebaseApp.configure
Auth.auth().useEmulator(withHost:"localhost", port:9099)
Storage.storage().useEmulator(withHost:"localhost", port:9199)
let settings = Firestore.firestore().settings
settings.host = "localhost:8080"
settings.isPersistenceEnabled = false
settings.isSSLEnabled = false
Firestore.firestore().settings = settings
What am I missing, or is this a bug?
I also had this issue. It seems to have been resolved for me in version 11.8.0. As a temporary workaround, I resorted to allowing all reads/writes so that I wasn't having to use my production environment and pay for usage. Not an ideal solution, but it unblocked me.
But for those who might be having similar issues, try updating to the latest firebase-tools:
npm install -g firebase-tools
Be sure to address any issues with:
npm audit fix
Or make the following change to the storage.rules file:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
Related
We are deploying a remote app written in NextJS and Typescript; The host app is in React only.
Currently the host app gets a 404 not found error as the remote app runs into this error in the Build Snapshot on Jenkins
+ ls ./dist/static/chunks/remoteEntry.js
ls: cannot access './dist/static/chunks/remoteEntry.js': No such file or directory
script returned exit code 2
However, the file is generated locally and both apps are able to spin up in local environment.
Here is our next.config.js:
const NextFederationPlugin = require('#module-federation/nextjs-mf');
const { exposedModules } = require('./lib/routes');
const version = process.env.VERSION_OVERRIDE || require('./package.json').version;
const deps = require('./package.json').dependencies;
// Note: This path needs to match with what's specified in CIRRUS_FRONTEND_ENTRYPOINT for www.
const assetBasePath = process.env.CDN_PATH ? `${process.env.CDN_PATH}${version}` : process.env.ASSET_BASE_PATH;
// Note: Heavily references module federation example meant for omnidirectional federation between Next apps.
// Changes mostly around path resolution due to our current resolution pattern via cdn
// https://github.com/module-federation/module-federation-examples/blob/master/nextjs/home/next.config.js
module.exports = {
webpack(config, options) {
Object.assign(config.experiments, { topLevelAwait: true });
// Integrated mode calls `next build` which has minimization by default. For local development, this is unnecessary.
if (process.env.NEXT_PUBLIC_ENVIRONMENT === 'INTEGRATED') {
config.optimization.minimize = false;
}
if (!options.isServer) {
console.log("Not Server");
config.output.publicPath = 'auto';
config.plugins.push(
new NextFederationPlugin({
name: 'cirrus',
filename: 'static/chunks/remoteEntry.js',
exposes: {
'./FederatedRouter': './lib/FederatedRouter',
...exposedModules
},
remoteType: 'var',
remotes: {},
shared: {
'#transcriptic/amino': {
requiredVersion: deps['#transcriptic/amino'],
singleton: true
},
react: {
requiredVersion: deps.react,
singleton: true
},
'react-dom': {
requiredVersion: deps['react-dom'],
singleton: true
},
'#strateos/micro-apps-utils': {
requiredVersion: deps['#strateos/micro-apps-utils'],
singleton: true
}
},
extraOptions: {
// We need to override the default module sharing behavior of this plugin as that assumes a nextjs host
// and thus next modules will be provided by the parent application.
// However, web is currently NOT a nextjs application so this child application so that assumption is
// invalid. Note that this means we need to ensure we explicitly specify common modules such as `react`
// in the `shared` key above.
skipSharingNextInternals: true
}
})
);
} else {
console.log("Is Server");
}
return config;
},
// Note: Annoyingly, NextJS automatically automatically appends a `_next` directory for assetPrefix
// but NOT public path so we'll have to manually include it here.
publicPath: `${assetBasePath}/_next/`,
// Note: If serving assets via CDN, assetPrefix is required to help resolve static assets.
// Also, NextJS automatically appends and expects a `_next` directory to the assetPrefix path.
// See https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix
assetPrefix: process.env.CDN_PATH ? assetBasePath : undefined,
distDir: 'dist',
// Use index react-router as fallback for resolving any pages that are not directly specified
async rewrites() {
return {
fallback: [
{
source: '/:path*',
destination: '/'
}
]
};
}
};
Tried upgrade NextJS from 12.1.6 to 12.2.2
Tried upgrade Webpack from 5.74.0 to 5.75.0
Cleaned cache by sh 'yarn cache clean'
Tried clear env by sh 'env -i PATH=$PATH make build-snapshot'
Hash of node modules by tar -cf - node_modules | md5sum
Downgraded "#module-federation/nextjs-mf" from 5.12.9 to 5.10.5
Verified file writing permission
I build an electron app with auto-update enabled. After running the application on Windows, I got an error emitted by my application which is "Error: Can not find Squirrel".
After look into the code of electron project for finding the error message.
checkForUpdates () {
const url = this.updateURL;
if (!url) {
return this.emitError(new Error('Update URL is not set'));
}
if (!squirrelUpdate.supported()) {
return this.emitError(new Error('Can not find Squirrel'));
}
this.emit('checking-for-update');
squirrelUpdate.checkForUpdate(url, (error, update) => {
if (error != null) {
return this.emitError(error);
}
if (update == null) {
return this.emit('update-not-available');
}
this.updateAvailable = true;
this.emit('update-available');
squirrelUpdate.update(url, (error) => {
if (error != null) {
return this.emitError(error);
}
const { releaseNotes, version } = update;
// Date is not available on Windows, so fake it.
const date = new Date();
this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {
this.quitAndInstall();
});
});
});
}
And after check the function squirrelUpdate.supported(). I know it is because the install location has no file "Update.exe".
I use electron-builder to generate my application and there is no Update.exe in unpacked packaged directory. How do I generate the Update.exe file?
The block of configuration of electron-builder in package.json is blow:
"win": {
"target": [
"nsis"
],
"defaultArch": "x64",
"verifyUpdateCodeSignature": false
},
How to solve the problem? Thanks.
The reason there is no update.exe is because you have "nsis" as the target package type.
The auto updater package you are trying to use is meant to be compatible with Squirrel.Windows. If you change your target to "squirrel" it will have the update.exe you are looking for.
There are additional dependencies required when using Squirrel.Windows; see below:
https://www.electron.build/configuration/win
#IBAction func forgotPasswordTapped(_ sender: Any) {
if let username = self.emailTextField.text {
PFUser.requestPasswordResetForEmail(inBackground: username) { (success, error) in
if(success) {
print("forgot password successful and sent")
}
}
}
}
When that function is called, I get the following error message
"An appName, publicServerURL, and emailAdapter are required for password reset and email verification functionality. (Code: 1, Version: 1.16.0)"
Is there something that I need to do with Heroku mail settings to enable it? If yes, would you give me directions on how to do it? I tried using the "mailgun" and "sendgrid" add on for Heroku, but didn't know how to configure it.
screenshot of my parse dashboard : https://www.evernote.com/l/Aq9A4JQSO_1L3rEmnFuZOyHsVvs7gY5Ttc8
In your package.json, make sure you have the mailgun adapter.
"dependencies": {
"parse-server-simple-mailgun-adapter": "*"
}
Then in your index.js or wherever you start the api.
var api = new ParseServer({
appName: 'App Name',
appId: 'app Id',
emailAdapter: {
"module": "parse-server-simple-mailgun-adapter",
"options": {
"fromAddress": "address#youremail.com",
"domain": "your.mailgun.domain",
"apiKey": "mailgun-api-key"
}
}
})
If this was helpful you should mark it as the accepted answer.
In Xamarin, I am trying to sync the local database with sync gateway, but it is not syncing.
I am trying it with sample https://github.com/couchbaselabs/mini-hacks/tree/master/kitchen-sync
Local database is getting updated but it is not syncing with sync gateway
I have provided the sync url:http://localhost:4984/sync_gateway/
Also updated config file
{
"interface": ":4984",
"adminInterface": ":4985",
"log":["CRUD+", "REST+", "Changes+", "Attach+"],
"databases": {
"sync_gateway": {
"server": "walrus:data",
"bucket": "sync_gateway",
"sync": `function(doc)
{
channel(doc.channels);
}`,
"users": {
"GUEST": {
"disabled": true,
"admin_channels": [ "*" ]
}
}
}
On checking the data bucket, item count is not getting added up. Can anyone help me out.
I am running Sensu as a series of Docker containers (sensu-server, sensu-api, n sensu-clients, rabbitmq and redis). While the clients successfully register themselves and run checks requested by the server, and whose checks will be reported via handlers and via /clients, API calls to /checks return nothing.
Server config:
{
"rabbitmq":{
"host": "rabbitmq"
},
"redis":{
"host":"redis"
},
"api":{
"host":"api",
"port":4567
}
"handlers": { ... },
"checks": { ... }
}
API config:
{
"rabbitmq":{
"host":"rabbitmq"
},
"redis":{
"host":"redis"
},
"api":{
"host":"api",
"port":4567
}
}
Client config:
{
"client":{
"name":"openshift-{{ .Env.AVAILABILITY_ZONE }}",
"address":"{{ .Env.HOSTNAME }}",
"subscriptions":[
"{{ .Env.AVAILABILITY_ZONE }}",
"any-client"
]
},
{
"rabbitmq":{
"host":"rabbitmq"
}
}
}
I solved this in a similar scenario - our configuration didn't give the api & servers (which ran inside separate docker containers) a copy of the check definitions.
Here's the Github issue that lead me to it: https://github.com/sensu/uchiwa/issues/83#issuecomment-51917336