I'm having issues with this and other methods of setting permissions for iOS in Detox. My app will initially launch with the notification popup, then if I dismiss the popup, the app will relaunch without the notification, but it is still requiring manual intervention. My code in init.js is:
beforeAll(async () => {
await detox.init(undefined, { launchApp: false });
await device.launchApp({ permissions: { notifications: 'YES' } });
});
I have also tried the alternative approach found in this thread yielding the same results: https://github.com/wix/Detox/pull/2009
Found the fix here:
https://github.com/wix/Detox/pull/2009#issuecomment-648971528
With this new integration with jest-circus. How should I launch the app with the permissions I need?
I got my tests working again by overriding the initDetox function in my CustomDetoxEnvironment like this:
async initDetox() {
const instance = await this.detox.init(undefined, {launchApp: false});
await instance.device.launchApp({permissions: {notifications: 'YES'}});
return instance;
}
This ended up working for me
Related
I'm getting an error while trying to get a Core wallet account. It happens when I reload the page. It should detect the account but it is not. I'm using Vite with web3modal and ethers. I also use Core wallet Avalanche Fuji test network.
Here is what console looks like:
Here is my code for checking accounts:
const updateCurrentWalletAddress = async () => {
const accounts = await window?.ethereum?.request({
method: "eth_requestAccounts"
}).catch((err)=>{
console.log(err)})
if(accounts){
setWalletAddress(accounts[0])
}
}
Here is the useEffect hook for checking:
useEffect(() => {
updateCurrentWalletAddress()
window?.ethereum?.on("accountsChanged", updateCurrentWalletAddress)
}, []);
I tried clearing browser data, cache and cookies. I tried creating a new account. I tried uninstalling Core Wallet.
The method name should be eth_accounts instead of eth_requestAccounts. This solved my problem.
I want to create a delete command where when you right click on a message, it will show under apps "Delete Message" from my bot. For example, Atlas has a set reminder (which seems useless) function under apps [image.] I would like to create this as a guild command. Also, I would like to know how to use the interaction create with this right-click-context-menu function. Thanks!
To register these commands, you need to set the type of the ApplicationCommand to 1 (or ApplicationCommandType.ChatInput). See the docs.
Everything else should stay the same except the type. You can register these commands the usual way, which is documented in the guide here
Here's a snippet:
// token should be your bot's token
const rest = new REST({ version: '10' }).setToken(token);
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
// commands should be an array of ApplicationCommands
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
console.error(error);
}
})();
I'm doing a PoC for Azure App Configuration. I created a free instance in our Azure env and added a couple of feature flags. The Issue I am having is with the JavaScript SDK when attempting to fetch feature flags from the App Configuration. Here's the snippet of code that I am using. (NOTE: the app is a React app w/ Typescript)
import { AppConfigurationClient } from '#azure/app-configuration';
import { GetConfigurationSettingResponse } from '#azure/app-configuration';
const appConfigClient = new AppConfigurationClient(process.env.REACT_APP_APPCONFIG_CONNECTION_STRING);
const requestFeatureFlags = async (): Promise<GetConfigurationSettingResponse> => {
const featureFlags = await appConfigClient.getConfigurationSetting({ key: '', label: 'my_feature_flags' });
console.log(featureFlags);
return featureFlags;
}
requestFeatureFlags().then((response) => { alert('I am here'); console.log(response) });
In the above I can see the request being made in the browser dev console and response with the feature flags, but the Promise is never returned from the await appConfigClient.getConfigurationSetting({ key: '', label: 'my_feature_flags' }); call. The console log of featureFlags yields this in the browser console ->
The alert inside the then() is never fired. So at this point I'm a loss lol. The SDK can be found here -> npm https://www.npmjs.com/package/#azure/app-configuration/v/1.1.0
If anyone else has come across this issue and help would be most appreciated!
I'ḿ setting up a jest test suite for a Node.js and Express REST API i'm building, i'm using #firebase/testing module to initialize a testing app, however when i try to perform any sort of operation to the database this error comes out:
FIRESTORE (7.17.2) INTERNAL ASSERTION FAILED: Unexpected state
at fail (/home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/util/assert.ts:39:9)
at hardAssert (/home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/util/assert.ts:53:5)
at fromBytes (/home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/remote/serializer.ts:270:5)
at fromWatchChange (/home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/remote/serializer.ts:486:25)
at PersistentListenStream.onMessage (/home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/remote/persistent_stream.ts:576:25)
at /home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/remote/persistent_stream.ts:456:21
at /home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/remote/persistent_stream.ts:509:18
at /home/cardonapablo/Documentos/Proyectos/Optica (Ilicit)../../../../../node_modules/#firebase/testing/node_modules/#firebase/firestore/src/util/async_queue.ts:369:14
I also tried connecting to my regular firestore database with the credentials i have been using to develop the endpoints and same error pops out even tho it's the app i use daily
Weird thing is, data is being written to the database, but error still stops testing
Here is firebase setup:
(src/db/functions.js)
let app = initializeTestApp({
projectId: "illicit"
})
db = app.firestore()
module.exports = { db }
Function throwing the error
(tests/fixtures/db.js)
const { db } = require('../../src/db/functions')
const bcrypt = require('bcrypt');
const createAdmin = async function() {
// Encrypt password
let encPass = await bcrypt.hash("admin", 8)
let admin = {
name: "Admin Test User",
email: "admin#test.com",
password: encPass,
tokens: []
}
// Add to db
let docRef = await db.collection('admins').add(admin) // <- This line throws the error
return;
}
module.exports = {
createAdmin
}
And finally testing file
(tests/glasses.test.js)
const supertest = require('supertest');
const app = require('../src/app')
const functions = require('./fixtures/db')
let adminToken;
let glassesId;
//Executes before any test, here is where error occurs, before any tests
beforeAll( async () => {
await functions.createAdmin()
return
})
test('Should log in an admin', async () => {
let response = await supertest(app)
.post('/admins/login')
.send({
email: 'admin#test.com',
password: 'admin'
})
.expect(200);
expect(response.body.token).toEqual(expect.any(String))
adminToken = response.token;
});
This only happens only when i try to test, regular app works just fine
Things i've tried:
Firestore rules are read and write true, so it's not a rules error
Mocked Firestore with firebase-mock and Jest seems to work fine, however this is not a
solution, since i need to test data inside the database
Hope you can help me :)
You should change Jest's test environment from the default jsdom to node using jest --env=node or by setting the testEnvironment option to node in your Jest config.
Solved the problem myself, i was using the Firebase web client, I switched to the Admin SDK made specifically for servers, i guess it was some sort of auth problem, because the admin sdk automatically authenticates you in the db
This is a open issue on GitHub. I'm pasting my comment from that issue here to hopefully help some other people:
I experienced the same error message on 9.6.6 with NextJS. I believe
this error message could be presented due to a range of errors - as I
see 100+ Stackoverflow questions with this error message.
After lots of debugging I realized I accidently used SQL
capitalization:
.orderBy('time', 'ASC') = "INTERNAL ASSERTION FAILED: Unexpected state" .orderBy('time', 'asc') = No Errors!
This was a pain to debug, and my mistake was so small. Maybe better
error reporting is needed in cases like this? When you get then Google
this error message it easily leads you down a path of debugging things
completely irrelevant to the real error.
So pretty much - a tiny syntax error can cause the error message and lead you down a road of debugging the wrong things. To solve this you have to find exactly where it is happening and narrow in your debuging.
execute this command with what is indicated a little above yarn test jest --env=node
after this the error disappears
I'm new to Slack bots so I went through their documentation and followed some tutorials on the internet but nothing seems to help. I'm trying to add a simple bot to a workspace I've just created, all I want is to make the bot post a message once it starts. Here is my code:
const SlackBot = require('slackbots');
const botToken = 'xoxp-XXXXXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXX'
const bots = async () => {
const bot = await new SlackBot({
token: botToken,
name: 'orderbot'
});
console.log('adding event listener...');
await bot.on('start', () => {
console.log('posting message...');
bot.postMessage('general', 'Feeling hungry?');
});
};
bots();
And in the OAuth & Permissions page, I've added ALL permissions to the token's scopes. Running the bot, here is my output:
adding event listener...
/home/mohammed/OrderBot/node_modules/vow/lib/vow.js:105
throw e;
^
Error: missing_scope
at /home/mohammed/OrderBot/node_modules/slackbots/index.js:46:33
So apparently, the error is coming from the .on listener which is quite confusing and I can't understand why this is happening. What exactly am I missing?
It seems like the module slackbots which I was using is not working properly (at least for me). I solved this issue by using #slack/web-api instead.